本文整理汇总了C#中RedisClient.ExecCachedLua方法的典型用法代码示例。如果您正苦于以下问题:C# RedisClient.ExecCachedLua方法的具体用法?C# RedisClient.ExecCachedLua怎么用?C# RedisClient.ExecCachedLua使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedisClient
的用法示例。
在下文中一共展示了RedisClient.ExecCachedLua方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_call_Cached_Lua
public void Can_call_Cached_Lua()
{
using (var redis = new RedisClient())
{
AddTestKeys(redis, 20);
var r = redis.ExecCachedLua(LuaScript, sha1 =>
redis.ExecLuaSha(sha1, "key:*", "10"));
Assert.That(r.Children.Count, Is.EqualTo(10));
r = redis.ExecCachedLua(LuaScript, sha1 =>
redis.ExecLuaSha(sha1, "key:*", "10"));
Assert.That(r.Children.Count, Is.EqualTo(10));
}
}
示例2: Can_call_Cached_Lua_even_after_script_is_flushed
public void Can_call_Cached_Lua_even_after_script_is_flushed()
{
using (var redis = new RedisClient())
{
var r = redis.ExecCachedLua(LuaScript, sha1 =>
redis.ExecLuaSha(sha1, "key:*", "10"));
Assert.That(r.Children.Count, Is.EqualTo(10));
redis.ScriptFlush();
r = redis.ExecCachedLua(LuaScript, sha1 =>
redis.ExecLuaSha(sha1, "key:*", "10"));
Assert.That(r.Children.Count, Is.EqualTo(10));
}
}
示例3: Can_call_script_with_complex_response
public void Can_call_script_with_complex_response()
{
using (var redis = new RedisClient())
{
var r = redis.ExecCachedLua(KeyAttributesScript, sha1 =>
redis.ExecLuaShaAsString(sha1, "key:*", "10"));
r.Print();
var results = r.FromJson<List<SearchResult>>();
Assert.That(results.Count, Is.EqualTo(10));
var result = results[0];
Assert.That(result.Id.StartsWith("key:"));
Assert.That(result.Type, Is.EqualTo("string"));
Assert.That(result.Size, Is.GreaterThan("value:".Length));
Assert.That(result.Ttl, Is.EqualTo(-1));
}
}