Clean and prep your gun carefully, then use one of those vacuum Seal-A-Meal gizmos - your pistol will be protected from moisture and contamination no matter were you store it. After that you could hang it on your shower head, throw it under the sink, or even drop it in the toilet tank for safe keeping.
Years ago I picked up a bunch of Lake City 5.56mm on stripper clips. So I set aside several hundred rounds, assembled them into bandoleers, and vacuum sealed them into plastic pouches. This stuff will keep for decades in the back of my closet, ready for the day that I really need it.
Most of them use "bags" that come on a roll, so you can make them as long as you want to. I've often thought of vacuum-sealing a complete AR. Maybe I'll build one on a Tannery Shop lower, vacuum seal it, and bury it in the backyard with a few bricks of the Lake City ammo because, well, you just never know.