I updated the StackExchange.Redis package from version 2.8.16 to 3.1.3, and now, in my functional tests, calls to KeyTypeAsync return Unknown instead of None when the key does not exist.
This behavior occurs in the following versions:
Package version
3.0.0
3.0.7
3.0.11
3.0.17
3.0.25
3.1.0
3.1.3
I tested version 2.13.17, which exhibits the expected behavior (returns None).
Code to reproduce
using StackExchange.Redis;
var connection = await ConnectionMultiplexer.ConnectAsync("127.0.0.1");
var database = connection.GetDatabase(0);
var type = await database.KeyTypeAsync("foo");
Console.WriteLine("{0}", type);
This appears to be an error in the token passed to the AsciiHashAttribute of the RedisType enum.
namespace StackExchange.Redis
{
public enum RedisType
{
[AsciiHash("")]
None,
[AsciiHash("string")]
String,
//...
}
}
As I understand it, RedisTypeMetadata.TryParse converts the command response according to the token defined in AsciiHash. For RedisType.None, an empty string is expected; however, the Redis TYPE command returns "none" when the key does not exist.
I updated the StackExchange.Redis package from version 2.8.16 to 3.1.3, and now, in my functional tests, calls to KeyTypeAsync return Unknown instead of None when the key does not exist.
This behavior occurs in the following versions:
Package version
3.0.0
3.0.7
3.0.11
3.0.17
3.0.25
3.1.0
3.1.3
I tested version 2.13.17, which exhibits the expected behavior (returns None).
Code to reproduce
This appears to be an error in the token passed to the AsciiHashAttribute of the RedisType enum.
As I understand it, RedisTypeMetadata.TryParse converts the command response according to the token defined in AsciiHash. For RedisType.None, an empty string is expected; however, the Redis TYPE command returns "none" when the key does not exist.