提交 8345e24c 编写于 作者: N Nikita

Fixed - remove hset command invocation during entry loading. #1282

上级 1b54139f
...@@ -151,8 +151,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac ...@@ -151,8 +151,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
" local expireIdle = redis.call('zscore', KEYS[3], ARGV[2]); " + " local expireIdle = redis.call('zscore', KEYS[3], ARGV[2]); " +
" if expireIdle ~= false then " + " if expireIdle ~= false then " +
" if tonumber(expireIdle) > tonumber(ARGV[1]) then " + " if tonumber(expireIdle) > tonumber(ARGV[1]) then " +
" local value = struct.pack('dLc0', t, string.len(val), val); " +
" redis.call('hset', KEYS[1], ARGV[2], value); " +
" redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), ARGV[2]); " + " redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), ARGV[2]); " +
" end ;" + " end ;" +
" expireDate = math.min(expireDate, tonumber(expireIdle)) " + " expireDate = math.min(expireDate, tonumber(expireIdle)) " +
...@@ -194,8 +192,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac ...@@ -194,8 +192,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
" local expireIdle = redis.call('zscore', KEYS[3], key); " + " local expireIdle = redis.call('zscore', KEYS[3], key); " +
" if expireIdle ~= false then " + " if expireIdle ~= false then " +
" if tonumber(expireIdle) > tonumber(ARGV[1]) then " + " if tonumber(expireIdle) > tonumber(ARGV[1]) then " +
" local value = struct.pack('dLc0', t, string.len(val), val); " +
" redis.call('hset', KEYS[1], key, value); " +
" redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), key); " + " redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), key); " +
" end; " + " end; " +
" expireDate = math.min(expireDate, tonumber(expireIdle)) " + " expireDate = math.min(expireDate, tonumber(expireIdle)) " +
...@@ -250,8 +246,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac ...@@ -250,8 +246,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
" local expireIdle = redis.call('zscore', KEYS[3], key); " + " local expireIdle = redis.call('zscore', KEYS[3], key); " +
" if expireIdle ~= false then " + " if expireIdle ~= false then " +
" if tonumber(expireIdle) > currentTime then " + " if tonumber(expireIdle) > currentTime then " +
" local value = struct.pack('dLc0', t, string.len(val), val); " +
" redis.call('hset', KEYS[1], key, value); " +
" redis.call('zadd', KEYS[3], t + currentTime, key); " + " redis.call('zadd', KEYS[3], t + currentTime, key); " +
" else " + " else " +
" map[i] = false; " + " map[i] = false; " +
...@@ -472,8 +466,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac ...@@ -472,8 +466,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
+ "local expireIdle = redis.call('zscore', KEYS[3], ARGV[2]); " + "local expireIdle = redis.call('zscore', KEYS[3], ARGV[2]); "
+ "if expireIdle ~= false then " + "if expireIdle ~= false then "
+ "if tonumber(expireIdle) > tonumber(ARGV[1]) then " + "if tonumber(expireIdle) > tonumber(ARGV[1]) then "
+ "local value = struct.pack('dLc0', t, string.len(val), val); "
+ "redis.call('hset', KEYS[1], ARGV[2], value); "
+ "redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), ARGV[2]); " + "redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), ARGV[2]); "
+ "end; " + "end; "
+ "expireDate = math.min(expireDate, tonumber(expireIdle)) " + "expireDate = math.min(expireDate, tonumber(expireIdle)) "
...@@ -646,8 +638,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac ...@@ -646,8 +638,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
+ "local expireIdle = redis.call('zscore', KEYS[3], ARGV[2]); " + "local expireIdle = redis.call('zscore', KEYS[3], ARGV[2]); "
+ "if expireIdle ~= false then " + "if expireIdle ~= false then "
+ "if tonumber(expireIdle) > tonumber(ARGV[1]) then " + "if tonumber(expireIdle) > tonumber(ARGV[1]) then "
+ "local value = struct.pack('dLc0', t, string.len(val), val); "
+ "redis.call('hset', KEYS[1], ARGV[2], value); "
+ "redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), ARGV[2]); " + "redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), ARGV[2]); "
+ "end; " + "end; "
+ "expireDate = math.min(expireDate, tonumber(expireIdle)) " + "expireDate = math.min(expireDate, tonumber(expireIdle)) "
...@@ -665,7 +655,7 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac ...@@ -665,7 +655,7 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
+ "local msg = struct.pack('Lc0Lc0', string.len(ARGV[2]), ARGV[2], string.len(ARGV[3]), ARGV[3]); " + "local msg = struct.pack('Lc0Lc0', string.len(ARGV[2]), ARGV[2], string.len(ARGV[3]), ARGV[3]); "
+ "redis.call('publish', KEYS[4], msg); " + "redis.call('publish', KEYS[4], msg); "
+ "end; " + "end; "
+ "local newValuePack = struct.pack('dLc0', t + tonumber(ARGV[1]), string.len(newValue), newValue); " + "local newValuePack = struct.pack('dLc0', t, string.len(newValue), newValue); "
+ "redis.call('hset', KEYS[1], ARGV[2], newValuePack); " + "redis.call('hset', KEYS[1], ARGV[2], newValuePack); "
// last access time // last access time
...@@ -1250,8 +1240,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac ...@@ -1250,8 +1240,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
+ "local expireIdle = redis.call('zscore', KEYS[2], key); " + "local expireIdle = redis.call('zscore', KEYS[2], key); "
+ "if expireIdle ~= false then " + "if expireIdle ~= false then "
+ "if tonumber(expireIdle) > currentTime then " + "if tonumber(expireIdle) > currentTime then "
+ "local value = struct.pack('dLc0', t, string.len(val), val); "
+ "redis.call('hset', KEYS[1], key, value); "
+ "redis.call('zadd', KEYS[2], t + currentTime, key); " + "redis.call('zadd', KEYS[2], t + currentTime, key); "
+ "end; " + "end; "
+ "end; " + "end; "
...@@ -1386,8 +1374,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac ...@@ -1386,8 +1374,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
+ "local expireIdle = redis.call('zscore', KEYS[3], ARGV[2]); " + "local expireIdle = redis.call('zscore', KEYS[3], ARGV[2]); "
+ "if expireIdle ~= false then " + "if expireIdle ~= false then "
+ "if tonumber(expireIdle) > tonumber(ARGV[1]) then " + "if tonumber(expireIdle) > tonumber(ARGV[1]) then "
+ "local value = struct.pack('dLc0', t, string.len(val), val); "
+ "redis.call('hset', KEYS[1], ARGV[2], value); "
+ "redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), ARGV[2]); " + "redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), ARGV[2]); "
+ "end; " + "end; "
+ "expireDate = math.min(expireDate, tonumber(expireIdle)) " + "expireDate = math.min(expireDate, tonumber(expireIdle)) "
...@@ -1850,8 +1836,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac ...@@ -1850,8 +1836,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
+ "local expireIdle = redis.call('zscore', KEYS[3], key); " + "local expireIdle = redis.call('zscore', KEYS[3], key); "
+ "if expireIdle ~= false then " + "if expireIdle ~= false then "
+ "if tonumber(expireIdle) > tonumber(ARGV[1]) then " + "if tonumber(expireIdle) > tonumber(ARGV[1]) then "
+ "local value = struct.pack('dLc0', t, string.len(val), val); "
+ "redis.call('hset', KEYS[1], key, value); "
+ "redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), key); " + "redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), key); "
+ "if maxSize ~= nil and maxSize ~= 0 then " + "if maxSize ~= nil and maxSize ~= 0 then "
+ " redis.call('zadd', KEYS[4], tonumber(ARGV[1]), key); " + " redis.call('zadd', KEYS[4], tonumber(ARGV[1]), key); "
...@@ -1893,8 +1877,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac ...@@ -1893,8 +1877,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
+ "local expireIdle = redis.call('zscore', KEYS[3], key); " + "local expireIdle = redis.call('zscore', KEYS[3], key); "
+ "if expireIdle ~= false then " + "if expireIdle ~= false then "
+ "if tonumber(expireIdle) > tonumber(ARGV[1]) then " + "if tonumber(expireIdle) > tonumber(ARGV[1]) then "
+ "local value = struct.pack('dLc0', t, string.len(val), val); "
+ "redis.call('hset', KEYS[1], key, value); "
+ "redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), key); " + "redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), key); "
+ "if maxSize ~= nil and maxSize ~= 0 then " + "if maxSize ~= nil and maxSize ~= 0 then "
+ " redis.call('zadd', KEYS[4], tonumber(ARGV[1]), key); " + " redis.call('zadd', KEYS[4], tonumber(ARGV[1]), key); "
...@@ -1939,8 +1921,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac ...@@ -1939,8 +1921,6 @@ public class RedissonMapCache<K, V> extends RedissonMap<K, V> implements RMapCac
+ "local expireIdle = redis.call('zscore', KEYS[3], key); " + "local expireIdle = redis.call('zscore', KEYS[3], key); "
+ "if expireIdle ~= false then " + "if expireIdle ~= false then "
+ "if tonumber(expireIdle) > tonumber(ARGV[1]) then " + "if tonumber(expireIdle) > tonumber(ARGV[1]) then "
+ "local value = struct.pack('dLc0', t, string.len(val), val); "
+ "redis.call('hset', KEYS[1], key, value); "
+ "redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), key); " + "redis.call('zadd', KEYS[3], t + tonumber(ARGV[1]), key); "
+ "if maxSize ~= nil and maxSize ~= 0 then " + "if maxSize ~= nil and maxSize ~= 0 then "
+ " redis.call('zadd', KEYS[4], tonumber(ARGV[1]), key); " + " redis.call('zadd', KEYS[4], tonumber(ARGV[1]), key); "
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册