Redis SORT BY使用Lua Script

时间:2017-09-05 02:16:45

标签: c# redis

我正在尝试使用LUA实现此命令 SORT gnm:dev:Conductor:ProjectID BY gnm:dev:Master:Project:*->CoreName ALPHA LIMIT 0 10

这在控制台中运行良好。

我在C#中使用LUA运行此语法错误(使用:* - >。注释行正常工作。)

LuaScript prepared = null;
prepared = LuaScript.Prepare($@"return redis.pcall('SORT', @key1,'BY', @key2, ':*->', @fieldName,'ALPHA','LIMIT',@min,@max)");
//prepared = LuaScript.Prepare($@"return redis.pcall('SORT', @key1, 'BY',@key2, 'ALPHA','LIMIT',@min,@max)");
   var list = client.GetDatabase().ScriptEvaluate(prepared, new
       {
           key1 = (RedisKey)new CacheKey("Conductor", "ProjectID").ToString(),
           key2 = (RedisKey)new CacheKey("Master", "Project").ToString(),
           fieldName = "CoreName",
           min = 0,
           max = 15
            });

0 个答案:

没有答案