密钥在Redis缓存中不可用

时间:2018-04-16 10:13:14

标签: azure stackexchange.redis

如果传递的StackExchange.Redis KeyDelete方法的密钥在redis缓存中不可用,会发生什么。它是否会抛出任何异常,或者它是否在内部处理缺失的密钥而不抛出任何异常?

long KeyDelete(RedisKey[] keys, CommandFlags flags = CommandFlags.None);

1 个答案:

答案 0 :(得分:2)

如果您在KeyDelete上按F12查看定义,它会告诉您"如果密钥不存在则会被忽略"

// Summary:
//     Removes the specified keys. A key is ignored if it does not exist.
//
// Returns:
//     The number of keys that were removed.
//
// Remarks:
//     http://redis.io/commands/del
long KeyDelete(RedisKey[] keys, CommandFlags flags = CommandFlags.None);

enter image description here