我试图在ASP.Net核心6中使用Redis缓存来实现分布式缓存。
但在SetAsync()命令->“error_description”上获得此异常:“错误地运行脚本(调用f_3915ee22fda531a1d5661f2523d0443fd35ff0a4):@user_script:2:@user_script: 2:从Lua脚本调用Redis命令的错误数量”
1)安装了Redis(3.0.504)本地( https://github.com/MicrosoftArchive/redis/releases) 2)我已经安装了https://github.com/MicrosoftArchive/redis/releases软件包3)我的AddAsync方法:
public async Task AddAsync(string key, byte[] value)
{
// Setting up the cache options
DistributedCacheEntryOptions options = new DistributedCacheEntryOptions()
.SetAbsoluteExpiration(DateTime.Now.AddMinutes(5))
.SetSlidingExpiration(TimeSpan.FromMinutes(3));
await _distributedCache.SetAsync(key, value, options, token);
}
发布于 2022-07-08 04:07:49
这个问题与Microsoft.Extensions.Caching.StackExchangeRedis
的版本有关。
Github问题:
调用IDistributedCache.SetAsync时接收错误:从Lua脚本#39879调用Redis命令的args数目错误
摘要:
我们可以很容易地复制这个问题,最新版本的好消息解决了这个问题。
所以我建议你可以使用.net 6
和Microsoft.Extensions.Caching.StackExchangeRedis 6.0.2
。
https://stackoverflow.com/questions/72895869
复制相似问题