Caching your data to Redis
Project description
Use Redis as a backend for caching
from redis_cache.cache_manager import CacheManager
from datetime import timedelta
from time import sleep
cache = CacheManager('localhost', port=6379, db=1, expiration=timedelta(days=1))
def sum(a, b):
sleep(2)
return a + b
cache('S', sum, 8, 5) # Took 2.1s
cache('S', sum, 8, 5) # Took 1.8ms
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file Python Redis Caching-0.0.6.tar.gz
.
File metadata
- Download URL: Python Redis Caching-0.0.6.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd64ac0f59ecc7f8f10299ca929f96c4b7dedee84abfed38e35d5bbc00b81b73 |
|
MD5 | cc5131daba0c2a74241893646a20c668 |
|
BLAKE2b-256 | 7b3d44aa90cd8368e9b187ec1116364691c052365b653059a96fd96764a221cb |
File details
Details for the file Python_Redis_Caching-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: Python_Redis_Caching-0.0.6-py3-none-any.whl
- Upload date:
- Size: 2.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bffc57b79d1e2c3afff15aed70231184eb6b4c490a8ad762ad11dc2e8760bd46 |
|
MD5 | 4456a933e1535a5bcd098adc19939523 |
|
BLAKE2b-256 | 32fd4e08413cf05517ce79d479cb6c52417ca8f13c71a89ece799d33c95cd787 |