如果传递的StackExchange.Redis KeyDelete方法的密钥在redis缓存中不可用,会发生什么。它是否会抛出任何异常,或者它是否在内部处理缺失的密钥而不抛出任何异常?
long KeyDelete(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
答案 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);