Caching count() in django models
Project description
Usage
from django_cached_counts import CachedCount
class MyModel(models.Model):
bar = models.ManyToManyField(Bar)
foo_count = CachedCount("foo_set", filter=Q(foo__x__gte=10))
total_user_count = CachedCount(User.objects.all())
m2m_count = CachedCount('bar_set')
class Foo(models.Model):
mymodel = models.ForeignKey(MyModel)
Those counts would be cached and invalidated when models Foo or User are saved/deleted
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
Close
Hashes for django_cached_counts-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e4165faad7d028cc5d3059d34e667084cbd6eba2d1cad97d7fd812c9dfd239b |
|
MD5 | a30baf04b722684355b4cd0fd908f3c0 |
|
BLAKE2b-256 | 4a1bc4815389db44d06681cb943e8878bfd056ec65ad0994109356f7aebc6f23 |
Close
Hashes for django_cached_counts-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0cffb45833f786cf4356a08e747ebb8aaa91d61b361091f5df0037b8e2bca05 |
|
MD5 | 49c7ab7800dbe0712983706f3756dd67 |
|
BLAKE2b-256 | 3258558cdacca0f791fa33704976e516ab0b6f196d60b49daa40c9da3c5ae87c |