【发布时间】:2020-08-11 22:53:48
【问题描述】:
MemoryCache 有一个Set 方法,让我可以指定一个委托,在通过CacheItemPolicy 参数从缓存中删除缓存条目之前调用该委托。
这可以用于定期auto refresh the cache,而无需使用 Hangfire 或其他一些任务运行器。
如何在 .NET 中使用 StackExchange.Redis 实现这一点?
我无法在Redis command reference 中找到任何适合我的目的的方法,并且我在网上找到的所有ObjectCache 实现都在它们的实现中抛出了NotSupportedException:
https://github.com/justinfinch/Redis-Object-Cache/blob/master/src/RedisObjectCache/RedisCache.cs https://www.leadtools.com/help/sdk/v20/dh/to/azure-redis-cache-example.html https://github.com/Azure/aspnet-redis-providers/pull/72/commits/2930ede272fe09abf930208dfe935c602c1bb510
【问题讨论】:
标签: .net caching redis stackexchange.redis