When I was using a lot of foam (replacing all windows/doors) I had a decent foam gun, and kept it cleaned after each usage, no problems.
Then when I started using it less frequently it started to get "gummed up" between uses, so I stripped it down, it was ok again for a bit, I tried leaving it with the foam can attached rather than stripping/cleaning, and that ended-up completely blocked, stripped it down again, and after the next time, gave up on the gun.
Instead I bought a hand-held can and a bunch of replacement nozzles, used it once, discarded nozzle, cleaned the spout of the can with acetone then left it stored upright, indoors.
Just came to use some a couple of months later, went to shake the can and "uh-oh that feels almost solid" gave it a vigorous shake anyway, didn't really do any good, attach nozzle but when pressed down not even a dribble would come out.
So it becomes expensive to use in small quantities ...