redis-lru
Installation
pip install redis-lru
Introduction
It’s often useful to have an lru redis cache. Of course, it’s also desirable not to have the cache grow too large, and cache expiration is often desirable. This module provides such a cache.
redis-lru supports CPython 3.4+
For the most part, you can just use it like this:
import redis
from redis_lru import RedisLRU
client = redis.StrictRedis()
cache = RedisLRU(client)
@cache
def f(x):
print("Calling f({})".format(x))
return x
f(3) # This will print "Calling f(3)", will return 3
f(3) # This will not print anything, but will return 3 (unless 15 minutes have passed between the first and second function call).
Additionally a datetime.time object can be provided to clear the cache at a specific time of the day:
@cache(expire_on=datetime.time(hour=8)) # clear at 08:00 o'clock
def b(x):
print("Calling f({})".format(x))
return x
0.1.2
Fixed support of non-hashable values
0.1.1
Added new expire_on parameter for @cache & RedisLRU support set ttl by datetime.time objects
0.1.0
Refactor RedisLRU class for a clean and neat implement.
Stop supporting Python 2.
Fix bugs in test cases.
Added clean cache option at process exit.
0.0.4
Generate unique_key automatically so your may never get touch this argument.
Improved exception processing, now you won’t receive any exception by default.
Added unittest for redis_lru_cache decorator and RedisLRUCacheDict
Added more type of cache usage statistic type like POP, DEL etc.
Added changes log.
Release files for redis-lru 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| redis-lru-0.1.2.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| redis_lru-0.1.2-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 11.0 kB
Release files / redis-lru-0.1.2.tar.gz
| Download URL | redis-lru-0.1.2.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
01a648cb42d8efdb9472c5c42980da3dad4be4b6d45f2d9811ff6f69bcbfb164
|
|
BLAKE2b-256 checksum How to use checksums |
d0d897d2a44501c1e527b03072abaa0c8a6462e92568da5fcf5078bdcb110b4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0
|
Release files / redis_lru-0.1.2-py2.py3-none-any.whl
| Download URL | redis_lru-0.1.2-py2.py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e6c2f56b43900b5a8f741d1db44bdcf423f228d6f3665f48a9ec6321c5579d0a
|
|
BLAKE2b-256 checksum How to use checksums |
968946e090f178697b93dc0d88043aa96cbe93aec5c2bd39ad2ad82eb0e8baec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0
|