redis-lru icon indicating copy to clipboard operation
redis-lru copied to clipboard

AttributeError: 'float' object has no attribute 'items' (redis 3 compatibility)

Open dconathan opened this issue 6 years ago • 2 comments

Current implementation/example doesn't work with redis>=3:

Traceback (most recent call last):
  File "test.py", line 9, in <module>
    f(3) # This will print "Calling f(3)", will return 3
  File "/home/devin/.local/share/virtualenvs/redis-fun-0aEUqbK5/lib/python3.6/site-packages/redis_lru/lru.py", line 48, in inner
    return lru_cache[key]
  File "/home/devin/.local/share/virtualenvs/redis-fun-0aEUqbK5/lib/python3.6/site-packages/redis_lru/lru.py", line 64, in wrapper
    return method(self, key, *args, **kwargs)
  File "/home/devin/.local/share/virtualenvs/redis-fun-0aEUqbK5/lib/python3.6/site-packages/redis_lru/lru.py", line 224, in __getitem__
    p.zadd(self.access_key, time.time(), key)
  File "/home/devin/.local/share/virtualenvs/redis-fun-0aEUqbK5/lib/python3.6/site-packages/redis/client.py", line 2263, in zadd
    for pair in iteritems(mapping):
  File "/home/devin/.local/share/virtualenvs/redis-fun-0aEUqbK5/lib/python3.6/site-packages/redis/_compat.py", line 123, in iteritems
    return iter(x.items())
AttributeError: 'float' object has no attribute 'items'

Pinning redis at redis==2.10.6 fixes this.

dconathan avatar Dec 13 '18 03:12 dconathan

I will fix it soon, sorry for this bug.

leohowell avatar Dec 22 '18 15:12 leohowell

please try again

leohowell avatar Jun 07 '19 07:06 leohowell