Opened 6 years ago

Closed 6 years ago

#29626 closed Cleanup/optimization (fixed)

Implement an optimized version of delete_many() for the db cache backend

Reported by: oliver Owned by: nobody
Component: Core (Cache system) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Now delete_many() in core.backends.base.BaseCache is as follows.

    def delete_many(self, keys, version=None):
        """
        Delete a bunch of values in the cache at once. For certain backends
        (memcached), this is much more efficient than calling delete() multiple
        times.
        """
        for key in keys:
            self.delete(key, version=version)

And cache.backends.db does not implement delete_many()
So if i retrieve 100 entries from the db cache, 100 queries are executed instead of just one
It should be fixed

This ticket is similar to https://code.djangoproject.com/ticket/29584

Change History (5)

comment:2 by Carlton Gibson, 6 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

This seems reasonable given #29584.
(Possibly merge?)

Version 0, edited 6 years ago by Carlton Gibson (next)

comment:4 by Tim Graham, 6 years ago

Patch needs improvement: unset
Summary: cache.backends.db does not implement delete_many()Implement an optimized version of delete_many() for the db cache backend
Triage Stage: AcceptedReady for checkin

comment:5 by Tim Graham <timograham@…>, 6 years ago

Resolution: fixed
Status: newclosed

In abd0ad76:

Fixed #29626, #29584 -- Added optimized versions of get_many() and delete_many() for the db cache backend.

Note: See TracTickets for help on using tickets.
Back to Top