SelfPopulatingCache
Sometimes, you want to use the BlockingCache, but the requirement to always release the lock results in complicated code. You also want to think about what you are doing without thinking about the caching. Enter the SelfPopulatingCache.
SelfPopulatingCache is synonymous with pull-through cache, which is a common caching term. However, SelfPopulatingCache is always used in addition to a BlockingCache.
SelfPopulatingCache uses a CacheEntryFactory which, given a key, knows how to populate the entry.
Note: JCache inspired getWithLoader and getAllWithLoader directly in Ehcache, which work with a CacheLoader may be used as an alternative to SelfPopulatingCache.
For more information, see the Javadoc at
http://www.ehcache.org/apidocs/2.10.1/ for SelfPopulatingCache.