Cache interfaces shouldn't need to know the internal workings of the CacheManager, nor have direct access to it. That's a leaky abstraction. They should just be concerned with saving the state of the cache to storage and loading it again.
In this PR I introduce a value object for the state of the cache, called CacheObject. Mostly it's a collection of CacheEntry objects but there's also a few metadata values which are kept by the state: revisionId and cacheVersion. Each cache interface now just has to persist a CacheObject and return one. If more cache interfaces are introduced in the future, this should greatly simplify their APIs.
Cache interfaces shouldn't need to know the internal workings of the
CacheManager
, nor have direct access to it. That's a leaky abstraction. They should just be concerned with saving the state of the cache to storage and loading it again.In this PR I introduce a value object for the state of the cache, called
CacheObject
. Mostly it's a collection ofCacheEntry
objects but there's also a few metadata values which are kept by the state:revisionId
andcacheVersion
. Each cache interface now just has to persist aCacheObject
and return one. If more cache interfaces are introduced in the future, this should greatly simplify their APIs.