All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
3.0.0 - 2026-03-25
- Unit test suite (
AspNetCoreCacheKit.Tests) using xUnit 2.x and realIMemoryCache - Repository restructured to support multiple projects: main project moved to
AspNetCoreCacheKit/subfolder, tests inAspNetCoreCacheKit.Tests/
ICacheService.Setis now generic:void Set<T>(string groupKey, string key, T value, TimeSpan? duration = null)— breaking changeICacheService.Setoverload without group is now generic:void Set<T>(string key, T value, TimeSpan? duration = null)— breaking change
Setfollowed byGetOrCreate<T>/GetOrCreateAsync<T>now works correctly — previouslySet(object)was type-incompatible with generic read methods causing cache misses
Set(string groupKey, string key, object value)→Set<T>(string groupKey, string key, T value): update all call sites to use the generic overload// before _cache.Set("users", "1", user); // after — type is usually inferred automatically _cache.Set("users", "1", user);
2.0.0 - 2026-03-24
- Per-group cache duration via
GroupDurationsinappsettings.json— each group key can now have its own expiration independent of the global default - Per-entry duration override — all
Set,GetOrCreateandGetOrCreateAsyncmethods now accept an optionalTimeSpan? durationparameter - Duration resolution priority chain: per-entry → per-group → global default
CancellationTokensupport on all async methods- Validation on
GroupDurationsvalues — all entries must be greater than zero, enforced at startup viaValidateOnStart RepositoryType,PackageProjectUrlandPackageReleaseNotesmetadata in.csproj
CacheOptions.Durationrenamed toCacheOptions.DurationMinutesfor clarity — breaking changeGetOrCreateAsyncnow usesIMemoryCache.GetOrCreateAsyncnatively instead of wrapping the synchronousGetOrCreate— fixes potential cache stampede under concurrent requestsICacheServiceregistration changed fromScopedtoSingletoninAddAspNetCoreCacheKit— aligns withIOptions<T>which is Singleton- Return types of
GetOrCreate<T>andGetOrCreateAsync<T>corrected fromTtoT?— reflects the nullable contract ofIMemoryCache GetFullKeynow returns the bare key whengroupKeyis empty, avoiding keys like:mykeyPackageTagsexpanded withgroup-cache,cache-expiration,dotnet,dependency-injectionDescriptionupdated to reflect new features
- Null checks in constructor moved before field assignments and applied to parameters, not fields
IOptionsSnapshot<CacheOptions>replaced withIOptions<CacheOptions>—IOptionsSnapshotwas being recreated on every HTTP request, causing unnecessary allocations for a static configuration- Redundant
services.Configure<CacheOptions>()call removed fromAddAspNetCoreCacheKit—AddOptions().Bind()already covers this - Redundant
.PostConfigure()removed — default value is now declared directly onCacheOptions.DurationMinutes
CacheOptions.Duration(TimeSpan) →CacheOptions.DurationMinutes(int): update yourappsettings.jsonaccordingly// before "CacheOptions": { "Duration": "00:60:00" } // after "CacheOptions": { "DurationMinutes": 60 }
ICacheServicemethods now returnT?instead ofT— callers may need to handle null returnsGetOrCreateAsyncandGetOrCreatesignatures now includeTimeSpan? duration = null— source-compatible (optional parameter), but binary-incompatible if you were using the interface via reflection
1.0.0 - 2025-01-01
- Initial release
ICacheServiceinterface withSet,GetOrCreate,GetOrCreateAsyncandDeletemethods- Group-based cache keys (
"group:key"format) CacheOptionswithIsEnabledandDurationflagsAddAspNetCoreCacheKit()andAddAspNetCoreCacheKit(IConfiguration)DI extension methods- Configuration validation with DataAnnotations and
ValidateOnStart - MIT license