LazyCache icon indicating copy to clipboard operation
LazyCache copied to clipboard

Refactor LazyCache to support the Options Pattern

Open alastairtree opened this issue 3 years ago • 0 comments

[Use the Thumbs Up reaction to vote for this feature, and please avoid adding comments like "+1" as they create noise for others watching the issue.]

LazyCache currently uses statics for some config such as default cache duration because of the age of the project. Remove all statics and instead use the more modern Options pattern with a strongly types options object which is more common in dotnet core. See https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-3.1

CachingService should add a constructor dependency on IOptions<LazyCacheOptions> options. LazyCacheOptions should have a properties for DefaultCacheDuration and NumberOfKeyLocks and anything else configurable.

This is a breaking change - requires a major version increase

alastairtree avatar Sep 21 '20 10:09 alastairtree