Unified caching code and protecting the cache from concurrent modifications.