Opened 7 years ago
Closed 7 years ago
#29584 closed Cleanup/optimization (fixed)
Implement an optimized version of get_many() for the db cache backend
Description ¶
The documentation of get_many
in django.core.cache.backends.base.BaseCache implies that the implementation of the method for a database backend can be much faster:
Fetch a bunch of keys from the cache. For certain backends (memcached, pgsql) this can be *much* faster when fetching multiple values.
However when I look into django.core.cache.backends.db I don't see any get_many
implementation meaning that retrieving 1000 entries from the cache will do 1000 queries instead of just one. This is really sad and makes this backend a no-go for any heavy usage of the cache.
Change History (10)
follow-up: 2 comment:1 by , 7 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Version: | 1.11 → master |
comment:2 by , 7 years ago
Replying to Simon Charette:
Are you interested in working on a patch?
It's not among my priorities, sorry. But once there's a fix, I hope it will be backported to 1.11.
comment:3 by , 7 years ago
This doesn't qualify for a backport based on our supported versions policy.
comment:4 by , 7 years ago
Cc: | added |
---|
comment:5 by , 7 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:8 by , 7 years ago
Has patch: | set |
---|---|
Patch needs improvement: | set |
comment:9 by , 7 years ago
Patch needs improvement: | unset |
---|---|
Summary: | cache.backends.db does not implement get_many → Implement an optimized version of get_many() for the db cache backend |
Triage Stage: | Accepted → Ready for checkin |
It should be straightforward to implement and test using
assertNumQueries
.Are you interested in working on a patch?