High-performance django model cache library.
Project description
ShadowModelCache
Developed by Qdagrw
ShadowModelCache is a high-performance library designed to create and manage cached copies of models, ensuring fast data retrieval and reduced load on primary data sources. It features automatic cache invalidation, various eviction policies, and supports distributed caching for scalable solutions.
Features
- High-performance caching
- Automatic cache invalidation
- Various eviction policies
- Support for distributed caching
How to Use
Set up the cache prefix and timeout:
SMC_PREFIX = 'ShadowModelCache'
SMC_CACHE_TIMEOUT = (60 * 60 * 24) # Cache timeout set to 24 hours
Define your model by extending ShadowModelCache:
from shadowmodelcache.models import ShadowModelCache
from django.db import models
class Demo(ShadowModelCache):
name = models.CharField(max_length=200)
def __str__(self):
return f"{self.id} - {self.name}"
In ORM
Retrieve a cached version of an object and automatically update the cache on save:
Demo.objects.cget(id=1)
This will return a cached version of the object and update the cache automatically when the object is saved.
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
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 shadowmodelcache-0.1.1.tar.gz.
File metadata
- Download URL: shadowmodelcache-0.1.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b18c77f6f5818c58c2c0612836b61bf9f36a901af6081d3637b25636ea6cab0
|
|
| MD5 |
ef5b68d1cab69333a2f5131637fc18e0
|
|
| BLAKE2b-256 |
ce3c996e89425cc70e1d7744725424df487fbf97f810ffdfd8113cb897a8c1c0
|
File details
Details for the file shadowmodelcache-0.1.1-py3-none-any.whl.
File metadata
- Download URL: shadowmodelcache-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f207e70196d60fdc7498ad31ce8fe1c6b7e3b0bae3990cc8af72027281e6975d
|
|
| MD5 |
55e02ce66af4dbe5b61aeb369478eebd
|
|
| BLAKE2b-256 |
3f0c7afc325564b251d50db28755dfdcbf0259bded63d82ddce5c8844c359b74
|