Simplified ContextCache to use fewer anonymous funs/captures and refactored AbstractCachingRepository to allow subclasses to implement their own context-cache strategies.