-
Notifications
You must be signed in to change notification settings - Fork 159
Upgrade to 2
tanbchr edited this page Mar 20, 2018
·
9 revisions
LazyCache 2 now depende on NetStandard 2.0 so you will need to migrate the rest of your app to that/netcore2 first.
- Upgrade app to netstandard2.0 or netcore2 or above
- Remove System.Runtime.Caching package/dependecy (We have moved to Microsft.Extension.Caching.Memory)
- Remove references to IAppCache.ObjectCache as Lazycache has changed to a cache provider model. To access the provider use IAppCache.CacheProvider instead.
- If using aspnet core or Microsft.Extension.DependecyInjection add package LazyCache.AspNetCore for easy dependency injection registration and add
ServiceCollection.AddLazyCache()
to your startup.cs; - If not using Microsft.Extension.DependecyInjection then add package LazyCache 2.x or above.
IAppCache cache = new CachingService()
core API has not changed - Try and run your app, fix any compiler issues
- Fix compiler warnings - note we have changed from CacheItemPolicy to MemoryCacheEntryOptions. RemovedCallback is now PostEvictionCallbacks.