There is a time factor and a risk factor. Nearly all containers, with the exception of crafting benches, restock periodically. It's pretty obviously a Random Number Generator that decides just when a given container will restock, with percentage modifiers for special circumstances. Whenever a container restocks, whatever is already in the container is overwritten -- it poofs out of existence. The longer you stash items in a container, the greater the probability that the stash will get overwritten.
Last night when I was playing, it was after hours there with no traders (Trashcan Carla) or my local booth traders active. So I stashed a couple thousand caps worth of stuff in a dresser. Then I ran across the map to Big John's Salvage where I had a loot stash, and picked that up. By the time I returned to Sanctuary the next day, the contents of that dresser had been replaced by a few caps and a paintbrush.
In contrast, there are several people here that insist that after a couple hundred hours of gameplay, they have NEVER seen any of their containers restock. So it seems it is just a matter of Luck whether or not it happens. So, as Dirty Harry asked, "Do you feel lucky?"