-
Notifications
You must be signed in to change notification settings - Fork 159
Upgrade to 2
LazyCache 2 now depends 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 Microsoft.Extensions.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 you are iterating over the keys in IObjectCache (say to remove a range of them) then you will no longer be able to do this. See Issue #66 for more information on addressing this.
-
If using aspnet core or Microsoft.Extensions.DependecyInjection add package LazyCache.AspNetCore for easy dependency injection registration and add
ServiceCollection.AddLazyCache()
to your startup.cs; -
If not using Microsoft.Extensions.DependecyInjection then add package LazyCache 2.x or above.
-
If using a different default cache period use the following to change the seconds in the cache, as it is no longer in the constructor
IAppCache cache = new CachingService(CachingService.DefaultCacheProvider); cache.DefaultCachePolicy.DefaultCacheDurationSeconds = 60 * 3; //3mins
-
Fix compiler warnings - note we have changed from CacheItemPolicy to MemoryCacheEntryOptions. RemovedCallback is now PostEvictionCallbacks.
-
Try and run your app, and lean on the compiler to help fix any breaking change
Spot anything else? Please edit this wiki!