A simple in-memory and Redis hybrid caching solution for .NET applications. It provides a way to cache frequently accessed data in memory for fast access and automatically falls back to using Redis as a persistent cache when memory cache capacity is exceeded.
$ dotnet add package HybridRedisCacheHybridRedisCache is a simple in-memory and Redis hybrid caching solution for .NET applications.
It provides a way to cache frequently accessed data in memory for fast access and automatically falls back to using Redis as a persistent cache when memory cache capacity is exceeded.
You can install the HybridRedisCache package using NuGet:
PM> Install-Package HybridRedisCache
To use HybridCache, you can create an instance of the HybridCache class and then call its Set and Get methods to cache and retrieve data, respectively.
Here's an example:
using HybridRedisCache;
...
// Create a new instance of HybridCache with Redis connection string and instance name
var cache = new HybridCache("localhost:6379", "myapp");
// Cache a string value with key "mykey" for 1 minute
cache.Set("mykey", "myvalue", TimeSpan.FromMinutes(1));
// Retrieve the cached value with key "mykey"
var value = cache.Get<string>("mykey");
Contributions are welcome! If you find a bug or have a feature request, please open an issue or submit a pull request.
If you'd like to contribute to HybridRedisCache, please follow these steps:
HybridRedisCache is licensed under the Apache License, Version 2.0. See the LICENSE file for more information.