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.2.tar.gz
(2.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redis-property-1.8.2.tar.gz.
File metadata
- Download URL: redis-property-1.8.2.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc5b49e1ae41a62f2989fa00ae39dc2e58e0a0a5e6e6159bcacae045fafa5d22
|
|
| MD5 |
4a5b56642d79391f4bbc1dafb1c5d319
|
|
| BLAKE2b-256 |
7dbb1151707e43ea60edf76e681a8ebe6326bfaf2503db95747621d878f7748b
|
File details
Details for the file redis_property-1.8.2-py3-none-any.whl.
File metadata
- Download URL: redis_property-1.8.2-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d60260fabd8d279f6d6848ebca6613444fa232687d95761146078069c4b2c45
|
|
| MD5 |
79693ab40bf926d8becd5d891edcc092
|
|
| BLAKE2b-256 |
7d9d20486f029ffe8bf114e020cc5c90d61ebd342f4b509c59182e6c89da4bbd
|