A decorator for caching properties in Redis.
Project description
redis-property
A decorator for caching properties in redis. Inspired by cached-property
Installation
pip3 install redis-property
How to use it
Setup redis_property
import redis_property
redis_property.configure(
"redis://:123456@example:6379/0",
lambda o, f: f"{type(o).__name__}:{o.id}:{f.__name__}"
)
use it like python property
from redis_property import redis_property
class Something:
id = 1
@redis_property(10) # 24h by default
def name(self):
return 1
something = Something()
print(something.name)
invalidating the cache
del something.name
work with cached-property
from cached_property import cached_property
from redis_property import redis_property
class Something:
id = 1
@cached_property
@redis_property
def name(self):
return 1
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
redis-property-1.8.1.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for redis_property-1.8.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c462968110f8cc4b77163177fd933b1e032d4a980fad16e76f9caf33fde2179a |
|
MD5 | fb0e806fde7bc16b7d6e746ad1dad0dd |
|
BLAKE2b-256 | 77866d182c9c576ad07c1e41504c996b64d100cca40dcbd16c5495807b55cd30 |