GithubHelp home page GithubHelp logo

leohowell / redis-lru Goto Github PK

View Code? Open in Web Editor NEW
41.0 2.0 13.0 24 KB

LRU cache for Python. Use Redis as backend. Provides a dictionary-like object as well as a method decorator. pip install redis-lru

Home Page: https://pypi.org/project/redis-lru/

License: BSD 2-Clause "Simplified" License

Python 100.00%
lru lru-cache redis redis-cache python3 cache python-cache

redis-lru's Introduction

Hi there ๐Ÿ‘‹

redis-lru's People

Contributors

funkyfuture avatar hohoangtung avatar hombit avatar leohowell avatar olegtropinin avatar shypard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

redis-lru's Issues

Non-hashable values in 0.1.1

Implementation of the excluded_values introduced in 0.1.1 does not allow to use non-hashable values. The problem is here, we cannot check if a non-hashable variable is in a set:

if value in self.exclude_values:

Note that it makes 0.1.1 incompatible with 0.1.0

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

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.

on reading data from redis-lru throwing error

Hi, looks like here reading data is in byte format and trying to converting using json loads. should be in string format

Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/redis_lru/lru.py", line 215, in getitem
value = json.loads(value)
File "/usr/lib/python3.5/json/init.py", line 312, in loads
s.class.name))
TypeError: the JSON object must be str, not 'bytes'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.