为什么 DeleteKey 对 Azure RedisCache 不起作用?

问题描述

我正在使用 Azure RedisCache,当我调用以下命令时:

_cache.KeyDelete(key,CommandFlags.HighPriority)

密钥没有被删除,也没有错误。

同样,如果已经设置了键/值,以下操作也不起作用:

_cache.StringSet(dataKey,"")
_cache.KeyExpire(dataKey,DateTime.UtcNow.AddDays(-2),CommandFlags.HighPriority)

解决方法

确保在配置字符串中启用 allowAdmin=trueConfiguarationoptions

您可以查看解决类似问题的 SO 线程。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...