在Redis4You和RedisLab redis服务器上使用MichaCo\CacheManager
嗨。我使用的是Redis4You托管的redis服务器。下面的配置工作正常。当代码到达行在Redis4You和RedisLab redis服务器上使用MichaCo\CacheManager,redis,stackexchange.redis,redis-server,cachemanager,Redis,Stackexchange.redis,Redis Server,Cachemanager,嗨。我使用的是Redis4You托管的redis服务器。下面的配置工作正常。当代码到达行Cache.Add(“a”、“b”),然后它在那里停留了无限长的时间。当我监视Redis服务器时,我看到控制台上充满了PING static class Program { static readonly ICacheManager<string> Cache = CacheFactory.Build<string>("Test", cbcp => {
Cache.Add(“a”、“b”)代码>,然后它在那里停留了无限长的时间。当我监视Redis服务器时,我看到控制台上充满了PING
static class Program
{
static readonly ICacheManager<string> Cache = CacheFactory.Build<string>("Test", cbcp =>
{
cbcp.WithSystemRuntimeCacheHandle("testCache")
.And
.WithRedisConfiguration("redis", rcb =>
{
rcb.WithEndpoint("<XXX>", 1111)
.WithPassword("<YYY>")
.WithAllowAdmin()
.WithDatabase(1);
})
.WithMaxRetries(100)
.WithRetryTimeout(10)
.WithRedisBackPlate("redis")
.WithRedisCacheHandle("redis", true);
});
static void Main(string[] args)
{
/* It stucks in the first line. */
Cache.Add("a", "b");
Console.ReadLine();
}
}
。。。这个luascript用于CacheManager库RedisCacheHandler.cs LoadScripts()方法中的这部分代码
那么,这里的问题是什么?(我不认为是这个版本,因为redis4you使用2.4,redislab使用redis的3.0.3。)redis4you现在使用Redisv2.4,redislab使用Redisv3.0.3。因此,RedisLab服务器工作正常,但Redis4You存在问题,因为RedisV2.4不支持脚本
CacheManager应修复此问题。顺便说一句,您可以通过IServer.Features.Scripting检查此可用性。感谢您在上发布此信息,让我们在那里讨论;)
local result=redis.call('HMSET', KEYS[1], 'value', ARGV[1], 'type', ARGV[2], 'expiration', ARGV[3], 'timeout', ARGV[4], 'created', ARGV[5])
if ARGV[3] ~= '0' and ARGV[4] ~= '0' then
redis.call('PEXPIRE', KEYS[1], ARGV[4])
else
redis.call('PERSIST', KEYS[1])
end
return result
var putLua = StackRedis.LuaScript.Prepare(ScriptPut);
putLua.Load(server);