A decorator that memoized into redis
Project description
Redis Cache Decorator
Installation
pip install redis-cache-deco
Example
from datetime import datetime
import redis
from redis_cache_deco import rcd
rcd.init_redis_cache(redis.Redis(host='localhost', port=6379, db=0))
@rcd.use_redis_cache(ttl=60)
def my_function(dt,array):
print("My Function")
return {"dt":dt,"array":array,"ret":"OK"}
res=my_function(datetime(2021,1,1,1,1),[{"a":1}])
print(res)
rcd.cache_stats()
parameters
init_redis_cache(redis_client_in,prefix_in="",debug_in=False)
- prefix_in: The prefix to use in redis
- debug_in: Bypass the redis cache
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file redis_cache_deco-1.0.8.tar.gz
.
File metadata
- Download URL: redis_cache_deco-1.0.8.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/41.2.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66316e1097ad2ab1a2f882dc51253b9632fbc17730558eea8b88e62d0541c3e5 |
|
MD5 | dd3e0c992f0902a385d73d80d62f1cf1 |
|
BLAKE2b-256 | 6a7e3cf56943aa3f318fbfe944415c5764056df55d39e6862a8c4abdc291c4a4 |