A few more LUA array indices started at 0

pull/509/head
jackygurui 9 years ago
parent 785a627a12
commit 009bfd05e2

@ -131,7 +131,7 @@ public class RedissonListMultimapCache<K, V> extends RedissonListMultimap<K, V>
+ "end; "
+ "if expireDate > tonumber(ARGV[1]) then " +
"local items = redis.call('lrange', KEYS[1], 0, -1); " +
"for i=0, #items do " +
"for i = 1, #items do " +
"if items[i] == ARGV[3] then " +
"return 1; " +
"end; " +

@ -179,7 +179,7 @@ public class RedissonSubList<V> extends RedissonList<V> implements RList<V> {
"local items = redis.call('lrange', KEYS[1], fromIndex, toIndex); " +
"for i=1, #items do " +
"for j = 0, #ARGV, 1 do " +
"for j = 1, #ARGV, 1 do " +
"if items[i] == ARGV[j] then " +
"redis.call('lrem', KEYS[1], count, ARGV[i]); " +
"v = 1; " +

@ -140,8 +140,8 @@ public class RedissonScoredSortedSetReactive<V> extends RedissonExpirableReactiv
public Publisher<Boolean> containsAll(Collection<?> c) {
return commandExecutor.evalReadReactive(getName(), codec, new RedisCommand<Boolean>("EVAL", new BooleanReplayConvertor(), 4, ValueType.OBJECTS),
"local s = redis.call('zrange', KEYS[1], 0, -1);" +
"for i = 0, table.getn(s), 1 do " +
"for j = 0, table.getn(ARGV), 1 do "
"for i = 1, table.getn(s), 1 do " +
"for j = 1, table.getn(ARGV), 1 do "
+ "if ARGV[j] == s[i] "
+ "then table.remove(ARGV, j) end "
+ "end; "
@ -171,7 +171,7 @@ public class RedissonScoredSortedSetReactive<V> extends RedissonExpirableReactiv
+ "while i <= table.getn(s) do "
+ "local element = s[i] "
+ "local isInAgrs = false "
+ "for j = 0, table.getn(ARGV), 1 do "
+ "for j = 1, table.getn(ARGV), 1 do "
+ "if ARGV[j] == element then "
+ "isInAgrs = true "
+ "break "

@ -224,8 +224,8 @@ public class RedissonSetCacheReactive<V> extends RedissonExpirableReactive imple
public Publisher<Boolean> containsAll(Collection<?> c) {
return commandExecutor.evalReadReactive(getName(), codec, RedisCommands.EVAL_BOOLEAN_WITH_VALUES,
"local s = redis.call('hvals', KEYS[1]);" +
"for i = 0, table.getn(s), 1 do " +
"for j = 0, table.getn(ARGV), 1 do "
"for i = 1, table.getn(s), 1 do " +
"for j = 1, table.getn(ARGV), 1 do "
+ "if ARGV[j] == s[i] then "
+ "table.remove(ARGV, j) "
+ "end "

Loading…
Cancel
Save