|
|
@ -164,13 +164,13 @@ public class RedissonSubList<V> extends RedissonList<V> implements RList<V> {
|
|
|
|
"local v = 0; " +
|
|
|
|
"local v = 0; " +
|
|
|
|
"local fromIndex = table.remove(ARGV, 1);" +
|
|
|
|
"local fromIndex = table.remove(ARGV, 1);" +
|
|
|
|
"local toIndex = table.remove(ARGV, 1);" +
|
|
|
|
"local toIndex = table.remove(ARGV, 1);" +
|
|
|
|
"local count = table.remove(ARGV, 3);" +
|
|
|
|
"local count = table.remove(ARGV, 1);" +
|
|
|
|
"local items = redis.call('lrange', KEYS[1], fromIndex, toIndex); " +
|
|
|
|
"local items = redis.call('lrange', KEYS[1], fromIndex, toIndex); " +
|
|
|
|
|
|
|
|
|
|
|
|
"for i=1, #items do " +
|
|
|
|
"for i=1, #items do " +
|
|
|
|
"for j = 1, #ARGV, 1 do " +
|
|
|
|
"for j = 1, #ARGV, 1 do " +
|
|
|
|
"if items[i] == ARGV[j] then " +
|
|
|
|
"if items[i] == ARGV[j] then " +
|
|
|
|
"redis.call('lrem', KEYS[1], count, ARGV[i]); " +
|
|
|
|
"redis.call('lrem', KEYS[1], count, ARGV[j]); " +
|
|
|
|
"v = 1; " +
|
|
|
|
"v = 1; " +
|
|
|
|
"end; " +
|
|
|
|
"end; " +
|
|
|
|
"end; " +
|
|
|
|
"end; " +
|
|
|
@ -329,13 +329,13 @@ public class RedissonSubList<V> extends RedissonList<V> implements RList<V> {
|
|
|
|
public RFuture<Integer> lastIndexOfAsync(Object o) {
|
|
|
|
public RFuture<Integer> lastIndexOfAsync(Object o) {
|
|
|
|
return commandExecutor.evalReadAsync(getRawName(), codec, RedisCommands.EVAL_INTEGER,
|
|
|
|
return commandExecutor.evalReadAsync(getRawName(), codec, RedisCommands.EVAL_INTEGER,
|
|
|
|
"local key = KEYS[1] " +
|
|
|
|
"local key = KEYS[1] " +
|
|
|
|
"local obj = ARGV[1] " +
|
|
|
|
"local obj = table.remove(ARGV, 1);" +
|
|
|
|
"local fromIndex = table.remove(ARGV, 1);" +
|
|
|
|
"local fromIndex = table.remove(ARGV, 1);" +
|
|
|
|
"local toIndex = table.remove(ARGV, 2);" +
|
|
|
|
"local toIndex = table.remove(ARGV, 1);" +
|
|
|
|
"local items = redis.call('lrange', key, tonumber(fromIndex), tonumber(toIndexs)) " +
|
|
|
|
"local items = redis.call('lrange', key, fromIndex, toIndex) " +
|
|
|
|
"for i = #items, 0, -1 do " +
|
|
|
|
"for i = #items, 1, -1 do " +
|
|
|
|
"if items[i] == obj then " +
|
|
|
|
"if items[i] == obj then " +
|
|
|
|
"return tonumber(ARGV[2]) + i - 1 " +
|
|
|
|
"return tonumber(fromIndex) + i - 1; " +
|
|
|
|
"end; " +
|
|
|
|
"end; " +
|
|
|
|
"end; " +
|
|
|
|
"end; " +
|
|
|
|
"return -1; ",
|
|
|
|
"return -1; ",
|
|
|
|