[Django] #29584: cache.backends.db does not implement get_many

56 views
Skip to first unread message

Django

unread,
Jul 21, 2018, 10:03:39 AM7/21/18
to django-...@googlegroups.com
#29584: cache.backends.db does not implement get_many
------------------------------------------------+------------------------
Reporter: Raphaël Hertzog | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Cache system) | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/29584>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 21, 2018, 11:25:29 AM7/21/18
to django-...@googlegroups.com
#29584: cache.backends.db does not implement get_many
--------------------------------------+------------------------------------

Reporter: Raphaël Hertzog | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Simon Charette):

* version: 1.11 => master
* easy: 0 => 1
* stage: Unreviewed => Accepted


Comment:

It should be straightforward to implement and test using
`assertNumQueries`.

Are you interested in working on a patch?

--
Ticket URL: <https://code.djangoproject.com/ticket/29584#comment:1>

Django

unread,
Jul 21, 2018, 6:31:01 PM7/21/18
to django-...@googlegroups.com
#29584: cache.backends.db does not implement get_many
--------------------------------------+------------------------------------

Reporter: Raphaël Hertzog | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Raphaël Hertzog):

Replying to [comment:1 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/29584#comment:2>

Django

unread,
Jul 21, 2018, 6:45:26 PM7/21/18
to django-...@googlegroups.com
#29584: cache.backends.db does not implement get_many
--------------------------------------+------------------------------------

Reporter: Raphaël Hertzog | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham):

This doesn't qualify for a backport based on our
[https://docs.djangoproject.com/en/dev/internals/release-process
/#supported-versions supported versions policy].

--
Ticket URL: <https://code.djangoproject.com/ticket/29584#comment:3>

Django

unread,
Jul 22, 2018, 3:46:36 PM7/22/18
to django-...@googlegroups.com
#29584: cache.backends.db does not implement get_many
--------------------------------------+------------------------------------

Reporter: Raphaël Hertzog | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Herbert Fortes):

* cc: Herbert Fortes (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/29584#comment:4>

Django

unread,
Jul 24, 2018, 2:19:28 AM7/24/18
to django-...@googlegroups.com
#29584: cache.backends.db does not implement get_many
--------------------------------------+------------------------------------
Reporter: Raphaël Hertzog | Owner: oliver
Type: Cleanup/optimization | Status: assigned

Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by oliver):

* owner: nobody => oliver
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/29584#comment:5>

Django

unread,
Jul 24, 2018, 4:57:37 AM7/24/18
to django-...@googlegroups.com
#29584: cache.backends.db does not implement get_many
--------------------------------------+------------------------------------
Reporter: Raphaël Hertzog | Owner: oliver
Type: Cleanup/optimization | Status: assigned
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by oliver):

Can I claim this ticket? I'm interested in this

--
Ticket URL: <https://code.djangoproject.com/ticket/29584#comment:6>

Django

unread,
Jul 29, 2018, 3:47:12 AM7/29/18
to django-...@googlegroups.com
#29584: cache.backends.db does not implement get_many
--------------------------------------+------------------------------------
Reporter: Raphaël Hertzog | Owner: oliver
Type: Cleanup/optimization | Status: assigned
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by oliver):

https://github.com/django/django/pull/10246

--
Ticket URL: <https://code.djangoproject.com/ticket/29584#comment:7>

Django

unread,
Jul 30, 2018, 11:46:55 AM7/30/18
to django-...@googlegroups.com
#29584: cache.backends.db does not implement get_many
--------------------------------------+------------------------------------
Reporter: Raphaël Hertzog | Owner: oliver
Type: Cleanup/optimization | Status: assigned
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/29584#comment:8>

Django

unread,
Aug 17, 2018, 3:20:37 PM8/17/18
to django-...@googlegroups.com
#29584: Implement an optimized version of get_many() for the db cache backend
-------------------------------------+-------------------------------------

Reporter: Raphaël Hertzog | Owner: oliver
Type: | Status: assigned
Cleanup/optimization |

Component: Core (Cache system) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/29584#comment:9>

Django

unread,
Aug 17, 2018, 3:58:31 PM8/17/18
to django-...@googlegroups.com
#29584: Implement an optimized version of get_many() for the db cache backend
-------------------------------------+-------------------------------------
Reporter: Raphaël Hertzog | Owner: oliver
Type: | Status: closed
Cleanup/optimization |
Component: Core (Cache system) | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"abd0ad7681422d7c40a5ed12cc3c9ffca6b88422" abd0ad76]:
{{{
#!CommitTicketReference repository=""
revision="abd0ad7681422d7c40a5ed12cc3c9ffca6b88422"
Fixed #29626, #29584 -- Added optimized versions of get_many() and
delete_many() for the db cache backend.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29584#comment:10>

Reply all
Reply to author
Forward
0 new messages