Fixes #8210 - Adding caching for smart-proxy puppet classes using Stefan Julin's implementation of cache

I'd like to move this and `unlock` to some helper but I need it both in `lib/proxy/http_downloads.rb` and `modules/puppet_proxy/puppet_cache.rb`. where is the best place to put it?