-
-
Notifications
You must be signed in to change notification settings - Fork 38
Closed
Description
Hi,
Thanks for the great library.
Maybe I'm missing something but I have come across an issue that is confusing me:
Consider:
var layers = new ICacheLayer[]
{
new RedisCacheLayer(cacheLayerMultiplexer, databaseIndex: 1),
};
var myCacheStack = new CacheStack(
layers,
new ICacheExtension[]
{
new RedisRemoteEvictionExtension(
cacheLayerMultiplexer,
new ICacheLayer[]{})), // Do not evict any layers for this example
});
// Add something to cache stack
await myCacheStack.SetAsync("hello:world", 123, TimeSpan.FromMinutes(5));
// Check redis, no key found
var result = await myCacheStack.GetAsync<int>("hello:world");
if (result == null)
{
Console.WriteLine("No cache entry");
}
I wasn't sure on the setup, originally I also had a MemoryCacheLayer as well, and I figured you would pass layersToEvict as:
layersToEvict = layers.Where(x => x.GetType() != typeof(RedisCacheLayer)).ToArray();
And pass this into the RedisRemoteEvictionExtension - however, whatever method I use to configure this extension, it seems to evict the key I add to redis, from redis, the moment its added.
Let me know if I have misunderstood something here! Thanks!
Metadata
Metadata
Assignees
Labels
No labels