1

以下是在 redis 中创建、获取和释放锁:

import redis

redis_url = 'redis://127.0.0.1:6379/'
redis_conn = redis.from_url(redis_url)

l = redis_conn.lock('lock-test')
l.acquire()
l.release()

怎么会acquire()抛出以下错误?

Traceback (most recent call last):
  File "C:/dev/myproj/test.py", line 11, in <module>
    l.acquire()
  File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\lock.py", line 111, in acquire
    if self.do_acquire(token):
  File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\lock.py", line 258, in do_acquire
    client=self.redis))
  File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\client.py", line 2646, in __call__
    return client.evalsha(self.sha, len(keys), *args)
  File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\client.py", line 1911, in evalsha
    return self.execute_command('EVALSHA', sha, numkeys, *keys_and_args)
  File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\client.py", line 565, in execute_command
    return self.parse_response(connection, command_name, **options)
  File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\client.py", line 577, in parse_response
    response = connection.read_response()
  File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\connection.py", line 574, in read_response
    raise response
redis.exceptions.ResponseError: unknown command 'EVALSHA'

我的设置:python 2.7.8,redis 2.4.5 64bit,win8

4

1 回答 1

1

升级到最新的 redis 为我解决了这个问题。
我最终使用VS13 从这个 repo构建了 2.8.16 版本

于 2014-09-19T08:08:07.747 回答