HzCache 0.0.6
dotnet add package HzCache --version 0.0.6
NuGet\Install-Package HzCache -Version 0.0.6
<PackageReference Include="HzCache" Version="0.0.6" />
paket add HzCache --version 0.0.6
#r "nuget: HzCache, 0.0.6"
// Install HzCache as a Cake Addin
#addin nuget:?package=HzCache&version=0.0.6
// Install HzCache as a Cake Tool
#tool nuget:?package=HzCache&version=0.0.6
HzCache
Simple Memory Cache for .NET Standard 2.0 backed by Redis pub/sub to be able to manage cache evictions across multiple instances of the same application.
TL;DR
Basically it's just a ConcurrentDictionary
with expiration with the ability to be notified of
changes and on top of that a Redis pub/sub to be able to manage cache evictions across multiple instances.
It's heavily inspired by Jitbit.FastCache with a bit inspiration
from FusionCache which is a much more feature rich implementation
and generally a better choice unless you have dependency between cache items. However it have the sad misfortune of
being based on IDistributedCache
(and I don't blame FusionCache, I blame the inventor of IDistributedCache
)
which makes it impossible to have dependency between cache items. And in this specific case that is managed
by using the ability to remove items using a pattern (with *
- asterisk as wildcard). Simply as that.
Works for my case, might work for you if you have the same problem as I had.
If you want a distributed cache, use Hazelcast.
Very fast
It's designed to be fast, really fast. In it's simplest configuration it's faster than IMemoryCache. However, adding value change notifications and Redis pub/sub makes it slower than IMemoryCache. But it's still quite fast when asynchronous notifications are enabled.
Ensure using the correct eviction policy
LRU
means that the cache expiry is extended at every read. This is the default policy.
FIFO
means that the cache expiry is extended at every write. This is the policy to use if you want to ensure that
data is re-read every now and then and don't have any other mechanisms to evict cache items.
Work in progress
The IHzCache
isn't completely thought through, but it covers many needs. Not your need? PR please.
Bug free? No, not at all. Please report bugs if you find them.
The IHzCache
isn't completely thought through, but it covers many needs. Not your? PR please.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- K4os.Compression.LZ4 (>= 1.3.8)
- Microsoft.Extensions.Caching.Memory (>= 6.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
- System.Reactive (>= 6.0.0)
- System.Threading.Tasks.Dataflow (>= 8.0.0)
- Utf8Json (>= 1.3.7)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on HzCache:
Package | Downloads |
---|---|
RedisBackplaneHzCache
Distributed cache invalidation using Redis Pub/Sub for HzCache |
|
RedisBackedHzCache
Distributed cache invalidation using Redis Pub/Sub for HzCache |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.0.6 | 150 | 3/27/2024 |
0.0.5 | 300 | 3/22/2024 |
0.0.4 | 149 | 3/21/2024 |
0.0.3 | 705 | 3/20/2024 |
0.0.2-preview-2 | 131 | 3/20/2024 |
0.0.2-preview-1 | 127 | 3/20/2024 |
0.0.1-preview-4 | 127 | 3/18/2024 |
0.0.1-preview-3 | 122 | 3/18/2024 |
0.0.1-preview-2 | 130 | 3/17/2024 |
0.0.1-preview | 95 | 3/17/2024 |