Low-level API changes are too numerous to document here, but from a high level:
- The
CacheManager
has now been abstracted to aBaseCacheManager
, in line with many of the other Dependency Injection changes in 8.2. - The
Cache
class has been abstracted to anICache
, allowing for other cache implementations in the future (e.g. Redis). - Statics on the
Cache
class for finding/creating a cache are no longer present -- you must utilize theCacheManager
. - The base cache implementation can now estimate object sizes itself, and all size arguments have been eliminated from the
Add
overloads on the cache. So above in your question, you can simply eliminate your third argument. The event handler it is looking for in your compiler error is an optional callback for when the object is removed from the cache. - If you really want to handle the size calculation yourself, there is the an
ICacheSizeCalculationStrategy
, which is set on a property ofCache<T>
, but the setter appears to beprivate
at this time. You would need to provide your ownICache
implementation. But this really is overkill -- in most production deployments you'll be disabling cache size limitations anyway.
You can find more details on the changesmore details on the changes in the Sitecore documentation.