1
redisClient.RemoveEntryFromHash(string hashId, string key);

无法删除多重键。

我在 IRedisNativeClient 接口中找到

int HDel(string hashId, byte[] key);

没有多功能键的选项

4

1 回答 1

0

尝试滚动您自己的扩展方法:

    public static void RemoveEntriesFromHash(this IRedisClient client, string hashId, List<string> keys)
    {
        if (keys == null || keys.Count == 0) return;

        var nativeClient = (RedisNativeClient)client;

        var keyBytes = new byte[keys.Count][];

        var i = 0;
        foreach (var key in keys)
        {
            keyBytes[i] = key.ToUtf8Bytes();
            i++;
        }

        nativeClient.HDel(hashId, keyBytes);
    }
于 2014-02-19T12:19:39.093 回答