Trying to use
KeyDelete(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
I have array of string[] , I am not seeing any examples out there when I search for converting these data types. I am not even sure how to create a new RedisKey.
Tried
RedisKey redisKey = new RedisKey("d");
above does not work, any suggestions?
From the source code RedisKey
has an implicit conversion from string
:
/// <summary>
/// Create a key from a String
/// </summary>
public static implicit operator RedisKey(string key)
{
if (key == null) return default(RedisKey);
return new RedisKey(null, key);
}
So you can create one by
RedisKey key = "hello";
or
var key = (RedisKey)"hello";
To convert an IEnumerable<string>
to RedisKey[]
, you can do:
var keys = strings.Select(key => (RedisKey)key).ToArray();