On Stockton Street, between Pacific and Broadway, on a block where every storefront sign is in two scripts, Mr. Henry Wong has run Wong’s Lock and Key out of a 14-foot-wide shop since 1994.

He is 67. He came to San Francisco from Taishan, China, with his parents in 1972. His father had been a blacksmith. His mother had been a seamstress. They opened a small upholstery shop on Pacific that closed in 1989 when the rent doubled. Mr. Wong, who had been working at a hardware store in the Sunset, took out a small business loan and opened the locksmith shop in 1994.

The shop is the size of a generous closet. There is a counter, a keying machine, a wall of blank keys, a small workbench, and, at the back, a wooden cabinet about three feet tall and two feet wide. The cabinet is unlabeled on the outside. Mr. Wong calls it, in Cantonese, the grandmothers’ cabinet.

Inside are spare keys to the apartments of about 40 elderly residents of the block. Each key hangs on a numbered hook. Each hook is matched, in a notebook on his counter, to a name and an apartment number. The system is private. He does not keep the addresses on the keys themselves.

The arrangement started in 1996. A woman named Mrs. Lo, who lived alone on Pacific, locked herself out one night during a rainstorm. She came to the shop in pajamas. Mr. Wong drove her home, picked the lock, and made her a spare key. Two weeks later he made a second spare key and asked her, in Cantonese, if he could keep it. She said yes. The next month, her neighbor, a man named Mr. Tang, asked for the same.

“I did not advertise,” Mr. Wong says. “Word moved on the block. By the year 2000, ten people had keys here. By 2010, thirty. Now it is forty. Some of those people have died. The keys are still in the cabinet. I cannot bring myself to take them out.”

He has used the cabinet about 90 times in 30 years. He keeps a count in the back of his notebook. Most of the time the call is small: someone has lost their keys, someone’s daughter is visiting from Sacramento and needs to be let in, someone’s grandson forgot to leave keys with someone before going on a school trip. Mr. Wong walks over, lets them in, and walks back. He does not charge.

He estimates four times in 30 years he has used a key for what he calls a real reason. A son in Daly City who could not reach his mother on the phone for two days. A grandson in Sacramento worried because the morning calls had stopped. A sister-in-law worried about the smell. In two of those cases the resident was alive, dehydrated, scared, embarrassed. In two, the resident had died. He stayed with each body until family or paramedics arrived. He did not charge anybody for any of those calls.

The most recent call was in February. Mrs. Liu, 91, who lived above the dim sum place on the corner, had not picked up for her granddaughter’s morning call for two mornings. The granddaughter, who lives in San Mateo, called the shop at 9:14 a.m. Mr. Wong walked over with the key. Mrs. Liu was on the floor of her bathroom. She had fallen on Saturday. It was Tuesday. She was conscious but very thirsty. He called 911 and stayed until the paramedics arrived. She is recovering at her granddaughter’s house. Her key is still on its hook.

“The cabinet is heavier than it was thirty years ago,” he says. “I do not mean the wood. I mean what is in it.”

His son, Kevin, who is 34 and works in finance in New York, has asked his father several times to retire. Mr. Wong listens. He says, when pressed, that he will retire when somebody is willing to take the cabinet. Nobody has offered yet. He is in no hurry.

On the Friday I visited, at 11:18 a.m., Mr. Wong was cutting two new keys for a man who had just bought an apartment on Powell. The blanks went into the keying machine. The machine hummed. The bits of brass curled off in tight spirals onto the floor. Mr. Wong handed the keys across the counter and made change for a twenty-dollar bill.

He does not put the new keys in the cabinet. He told me he only puts a key in the cabinet when the customer asks. He has never asked anyone to put one there. He has never said no to anyone who has.