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
File details
Details for the file shadowmodelcache-0.1.0.tar.gz
.
File metadata
- Download URL: shadowmodelcache-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57743fa9ef38206f287f71f954f06449062703558780612c4aa1a465a1c96e9c |
|
MD5 | 06e4f60859d385daa8d4853ea7f3ad9c |
|
BLAKE2b-256 | 424865dad06c78f1b79eaf4d8d77cdf49e498543bb31e93f457a2f4018b43fef |
File details
Details for the file shadowmodelcache-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: shadowmodelcache-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0924540cee407dc48f990bc97ecb6b9318a824d0b7c112cd59a76ecc24e99093 |
|
MD5 | 53b5d4ca44b8e39ad73b4643f5533d48 |
|
BLAKE2b-256 | 4d311d3389b981a5c6c5fc8d9e4775a9ba336e1709cec85c8dcd7bfd107c8ec3 |