StackExchange.Redis | TTL -2 |问题

StackExchange.Redis | TTL -2 | Issue

TTL状态码-2是什么意思?我正在尝试在调用 StringSet(key, value, expirationTimeSpan) 时为我的 Redis 键设置过期时间。

我设置了 1 分钟后到期。当我 运行 TTL MyKey 倒计时 59, 58, 57,.. 突然下降到-2.

我正在使用 Azure Redis 缓存服务基本 256mb 和 2.5gb 规模。

问题是什么?跟主动\被动过期有关系吗?

来自the docs

Starting with Redis 2.8 the return value in case of error changed:

  • The command returns -2 if the key does not exist.
  • The command returns -1 if the key exists but has no associated expire.

所以:它大概被删除了。