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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 377bdcc796147019dabf3afa7401f29b66e9068a92c6acdf83ff8d6149057017 |
|
MD5 | 15134a62a32b091f018e53cfc485e90d |
|
BLAKE2b-256 | 2c82da01d59238c594e7142660bd2737db3a24a6a39b7bcc20bb7ff42c0b09e4 |
Close
Hashes for django_cached_counts-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb586df406d54c3e877f6a30787ea3875270955ff959bee9620932424e1349ec |
|
MD5 | 4d4d885353e11752abef107b79d39421 |
|
BLAKE2b-256 | 41b4fe8c73a61d116aba3d4256a1254c0865f6e4d90ed928011300f799bb13a2 |