From 074e71014a4a51a0913928a92348ca1feaec9ce1 Mon Sep 17 00:00:00 2001 From: LamGC Date: Sun, 3 Jan 2021 11:28:52 +0800 Subject: [PATCH] =?UTF-8?q?[Fix]=20CacheStore-Redis=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20RemoveElementByIndex=20=E8=84=9A=E6=9C=AC=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=80=BC=E4=B8=8D=E7=BB=9F=E4=B8=80=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Fix] RemoveElementByIndex.lua 修复失败返回值不统一的问题; --- .../src/main/lua/RemoveElementByIndex.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ContentGrabbingJi-CacheStore-redis/src/main/lua/RemoveElementByIndex.lua b/ContentGrabbingJi-CacheStore-redis/src/main/lua/RemoveElementByIndex.lua index 4a7d865..d16a416 100644 --- a/ContentGrabbingJi-CacheStore-redis/src/main/lua/RemoveElementByIndex.lua +++ b/ContentGrabbingJi-CacheStore-redis/src/main/lua/RemoveElementByIndex.lua @@ -2,7 +2,7 @@ local key = tostring(KEYS[1]) local index = tonumber(ARGV[1]) if (key == nil) or (index == nil) then - return -1 + return 0 end local function getRandom(n) @@ -21,7 +21,7 @@ end; local flag = getRandom(24) if (redis.call("llen", key) <= index) or redis.call("lIndex", key, index) == nil then - return -1 + return 0 else redis.call("lSet", key, index, flag); return redis.call("lRem", key, 0, flag);