Service caching API
Project description
A caching API for python loosely modeled after the Java Caching API (JSR107).
Documentation: https://slycache.readthedocs.io.
Basic Usage
Start by registering a cache backend:
slycache.register_backend("default", my_cache_backend)
Define a key namespace:
# define a key namespace
user_cache = slycache.with_defaults(namespace="user")
Use the cache on methods and functions:
@user_cache.cache_result("{username}")
def get_user_by_username(username):
...
@user_cache.cache_result("{user_id}")
def get_user_by_id(user_id):
...
@user_cache.cache_put([
"{user.username}", "{user.user_id}"
])
def save_user(user):
...
@user_cache.cache_remove([
"{user.username}", "{user.user_id}"
])
def delete_user(user):
...
For more advanced usage see the documentation: https://slycache.readthedocs.io
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
slycache-0.3.0.tar.gz
(18.1 kB
view details)
Built Distribution
slycache-0.3.0-py3-none-any.whl
(14.6 kB
view details)
File details
Details for the file slycache-0.3.0.tar.gz
.
File metadata
- Download URL: slycache-0.3.0.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.9.2 Linux/5.4.0-1040-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22a19ec462373ea24d77994896b4c9ea1e8d7a41dfbe4d441a2413b30e4ef967 |
|
MD5 | c11c8ba4897cdf48f87362b57bbb4794 |
|
BLAKE2b-256 | 3409bb2c1b95e2b92ba117f3af048982d7f8275da6980056577eae51777f4a26 |
File details
Details for the file slycache-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: slycache-0.3.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.9.2 Linux/5.4.0-1040-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05822002e9e343578fd85a36c11b08da7946f7370af214f29ac26fc907229a51 |
|
MD5 | 09292cfcdd9dd4865f6990595af8998e |
|
BLAKE2b-256 | 34aafc79b9eed7e2fa5c108f825ba259a2698c8c45731484f211ee3fdcb26084 |