@@ -325,7 +325,7 @@ def zrangebyscore(self, table, priority_min, priority_max, count=None, is_pop=Tr
325325
326326 # 使用lua脚本, 保证操作的原子性
327327 lua = """
328- local key = KEYS[1]
328+ -- local key = KEYS[1]
329329 local min_score = ARGV[2]
330330 local max_score = ARGV[3]
331331 local is_pop = ARGV[4]
@@ -334,15 +334,15 @@ def zrangebyscore(self, table, priority_min, priority_max, count=None, is_pop=Tr
334334 -- 取值
335335 local datas = nil
336336 if count then
337- datas = redis.call('zrangebyscore', key , min_score, max_score, 'limit', 0, count)
337+ datas = redis.call('zrangebyscore', KEYS[1] , min_score, max_score, 'limit', 0, count)
338338 else
339- datas = redis.call('zrangebyscore', key , min_score, max_score)
339+ datas = redis.call('zrangebyscore', KEYS[1] , min_score, max_score)
340340 end
341341
342342 -- 删除redis中刚取到的值
343343 if (is_pop) then
344344 for i=1, #datas do
345- redis.call('zrem', key , datas[i])
345+ redis.call('zrem', KEYS[1] , datas[i])
346346 end
347347 end
348348
@@ -377,7 +377,7 @@ def zrangebyscore_increase_score(
377377
378378 # 使用lua脚本, 保证操作的原子性
379379 lua = """
380- local key = KEYS[1]
380+ -- local key = KEYS[1]
381381 local min_score = ARGV[1]
382382 local max_score = ARGV[2]
383383 local increase_score = ARGV[3]
@@ -386,14 +386,14 @@ def zrangebyscore_increase_score(
386386 -- 取值
387387 local datas = nil
388388 if count then
389- datas = redis.call('zrangebyscore', key , min_score, max_score, 'limit', 0, count)
389+ datas = redis.call('zrangebyscore', KEYS[1] , min_score, max_score, 'limit', 0, count)
390390 else
391- datas = redis.call('zrangebyscore', key , min_score, max_score)
391+ datas = redis.call('zrangebyscore', KEYS[1] , min_score, max_score)
392392 end
393393
394394 --修改优先级
395395 for i=1, #datas do
396- redis.call('zincrby', key , increase_score, datas[i])
396+ redis.call('zincrby', KEYS[1] , increase_score, datas[i])
397397 end
398398
399399 return datas
@@ -426,7 +426,7 @@ def zrangebyscore_set_score(
426426
427427 # 使用lua脚本, 保证操作的原子性
428428 lua = """
429- local key = KEYS[1]
429+ -- local key = KEYS[1]
430430 local min_score = ARGV[1]
431431 local max_score = ARGV[2]
432432 local set_score = ARGV[3]
@@ -435,9 +435,9 @@ def zrangebyscore_set_score(
435435 -- 取值
436436 local datas = nil
437437 if count then
438- datas = redis.call('zrangebyscore', key , min_score, max_score, 'withscores','limit', 0, count)
438+ datas = redis.call('zrangebyscore', KEYS[1] , min_score, max_score, 'withscores','limit', 0, count)
439439 else
440- datas = redis.call('zrangebyscore', key , min_score, max_score, 'withscores')
440+ datas = redis.call('zrangebyscore', KEYS[1] , min_score, max_score, 'withscores')
441441 end
442442
443443 local real_datas = {} -- 数据
@@ -448,7 +448,7 @@ def zrangebyscore_set_score(
448448
449449 table.insert(real_datas, data) -- 添加数据
450450
451- redis.call('zincrby', key , set_score - score, datas[i])
451+ redis.call('zincrby', KEYS[1] , set_score - score, datas[i])
452452 end
453453
454454 return real_datas
@@ -641,13 +641,13 @@ def hget(self, table, key, is_pop=False):
641641 return self ._redis .hget (table , key )
642642 else :
643643 lua = """
644- local key = KEYS[1]
644+ -- local key = KEYS[1]
645645 local field = ARGV[1]
646646
647647 -- 取值
648- local datas = redis.call('hget', key , field)
648+ local datas = redis.call('hget', KEYS[1] , field)
649649 -- 删除值
650- redis.call('hdel', key , field)
650+ redis.call('hdel', KEYS[1] , field)
651651
652652 return datas
653653
0 commit comments