Skip to content

Commit 316e784

Browse files
committed
v1.3.1 - Small improvement to enable inheriting from ILazySelfExpiringCacheResult<TValue> with protected setters, and small param naming improvements.
1 parent 56169d2 commit 316e784

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

LazyCacheHelpers/CacheRepositories/LazySelfExpiringCacheResult.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ namespace LazyCacheHelpers
55
{
66
public class LazySelfExpiringCacheResult<TValue> : ILazySelfExpiringCacheResult<TValue>
77
{
8-
public LazySelfExpiringCacheResult(TValue cacheItem, ILazyCachePolicy cachePolicy)
9-
: this(cacheItem, cachePolicy?.GeneratePolicy())
8+
public LazySelfExpiringCacheResult(TValue cacheItem, ILazyCachePolicy cachePolicyFactory)
9+
: this(cacheItem, cachePolicyFactory?.GeneratePolicy() ?? throw new ArgumentNullException(nameof(cachePolicyFactory)))
1010
{ }
1111

1212
public LazySelfExpiringCacheResult(TValue cacheItem, CacheItemPolicy cachePolicy)
@@ -15,9 +15,9 @@ public LazySelfExpiringCacheResult(TValue cacheItem, CacheItemPolicy cachePolicy
1515
CachePolicy = cachePolicy ?? throw new ArgumentNullException(nameof(cachePolicy));
1616
}
1717

18-
public CacheItemPolicy CachePolicy { get; }
18+
public CacheItemPolicy CachePolicy { get; protected set; }
1919

20-
public TValue CacheItem { get; }
20+
public TValue CacheItem { get; protected set; }
2121

2222
public static ILazySelfExpiringCacheResult<TValue> From(TValue cacheItem, int absoluteExpirationMillis)
2323
=> From(cacheItem, TimeSpan.FromMilliseconds(absoluteExpirationMillis));
@@ -37,8 +37,8 @@ public static ILazySelfExpiringCacheResult<TValue> From<TValue>(TValue cacheItem
3737
public static ILazySelfExpiringCacheResult<TValue> From<TValue>(TValue cacheItem, TimeSpan absoluteExpirationTimeSpan)
3838
=> new LazySelfExpiringCacheResult<TValue>(cacheItem, LazyCachePolicy.NewAbsoluteExpirationPolicy(absoluteExpirationTimeSpan));
3939

40-
public static ILazySelfExpiringCacheResult<TValue> From<TValue>(TValue cacheItem, CacheItemPolicy cacheEvictionPolicy)
41-
=> new LazySelfExpiringCacheResult<TValue>(cacheItem, cacheEvictionPolicy);
40+
public static ILazySelfExpiringCacheResult<TValue> From<TValue>(TValue cacheItem, CacheItemPolicy cacheItemPolicy)
41+
=> new LazySelfExpiringCacheResult<TValue>(cacheItem, cacheItemPolicy);
4242

4343
}
4444
}

LazyCacheHelpers/LazyCacheHelpers.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<Description>Library for leveraging the power of the Lazy class to enable high performance caching at all layers of an application. It provides support for both Sync and Async Lazy caching operations in an extremely lightweight and simple footprint -- with passive cache coding style using Lambdas to maximize server utilization and performance with a blocking, or self-populating, cache implementation!</Description>
1212
<PackageTags>cache caching memory memorycache in-memory lazy loading load self populate populating abstraction abstract thread threadsafe thread-safe safe performance optimization optimize server utilization</PackageTags>
1313
<PackageReleaseNotes>
14+
- v1.3.1 Added support for inheriting from the new ILazySelfExpiringCacheResult&lt;TValue&gt;, with protected property setters, as well as small param naming improvements.
1415
- Add support for Self Expiring cache results that return the CachePolicy/Cache TTL/etc. along with the Cache Result; ideal when the cache TTL is not
1516
known ahead of time in use cases such as external API results that also return a lifespan for the data such as Auth API Tokens, etc.
1617
- This should not be a breaking change as this support was now added via net new interfaces ILazyCacheHandlerSelfExpiring and ILazySelfExpiringCacheResult.
@@ -29,7 +30,7 @@
2930
- Now fully supported as a .Net Standard 2.0 library (sans Configuration reader helpers) whereby you can specify the timespan directly for Cache Policy initialization.
3031
- Initial nuget release for .Net Framework.
3132
</PackageReleaseNotes>
32-
<Version>1.3.0</Version>
33+
<Version>1.3.1</Version>
3334
</PropertyGroup>
3435

3536
<ItemGroup>

0 commit comments

Comments
 (0)