我试图在Redis中运行HSCAN命令,以便只匹配通过C#所需的散列字段
这就是代码的样子。
var options = new ConfigurationOptions
{
EndPoints = { "endpoint" },
Proxy = Proxy.Twemproxy
};
twemproxy_new = ConnectionMultiplexer.Connect(options);
db = twemproxy_new.GetDatabase();
Dictionary<string,string> inputDict = new Dictionary<string, string>();
// populate inputDict with "n" fields & values
var cachekey = "my_hash";
db.GetDatabase().HashSet(cachekey, inputDict, CommandFlags.FireAndForget);
db.HashScan(cacheKey, "*9*");
// this is where it fails with the exception
// Command is not available on your server: HSCAN但是,当我在双代理服务器上运行HSCAN命令时,它似乎像预期的那样工作。
*
我遗漏了什么?
谢谢
发布于 2016-07-31 18:40:57
在运行窗户上的红宝石时,我也遇到了同样的问题,我认为这是因为在运行beta版本时,StackExchange.Redis库无法解析服务器返回的Redis版本,因此它假定Redis的较低版本不包含HSCAN命令。
在我的示例中,服务器将返回以下字符串作为Redis版本:
3.0.300-beta1
当SE.Redis试图解析版本字符串(ResultProcessor.cs)时:
Version version;
if (Version.TryParse(val, out version))
{
server.Version = version;
server.Multiplexer.Trace("Auto-configured version: " + version);
}将无法解析版本号,因为版本字符串的-beta1部分,即参数应该具有以下格式,如MSDN中所述
major.minor[.build.revision]
尝试运行非beta版本的redis。
我刚刚在问题 github上打开了一个关于这个的SE.Redis。
https://stackoverflow.com/questions/38667607
复制相似问题