Opened 8 years ago

Closed 8 years ago

#2561 closed defect (fixed)

memcached backend ignores default timeout?

Reported by: Christopher Lenz <cmlenz@…> Owned by: jacob
Component: Core (Cache system) Version: 0.95
Severity: major Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Okay, I might be missing something obvious here… but does the memcached backend even use the default timeout specified in the query string of the CACHE_BACKEND setting? The code doesn't suggest so. Doesn't that mean that cache entries only time out when the memory limit configured for memcached is reached?

The following patch should remedy that AFAICT:

Index: django/core/cache/backends/
--- django/core/cache/backends/     (revision 852)
+++ django/core/cache/backends/     (working copy)
@@ -20,7 +20,7 @@
             return val
     def set(self, key, value, timeout=0):
-        self._cache.set(key, value, timeout)
+        self._cache.set(key, value, timeout or self.default_timeout)
     def delete(self, key):

BTW, there's no 0.95 version to select here.

Attachments (0)

Change History (2)

comment:1 Changed 8 years ago by adrian

  • Version changed from SVN to 0.95

(I've added a 0.95 version to Trac -- thanks for the pointer.)

comment:2 Changed 8 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(In [3611]) Fixed #2561 -- memcached cache backend no longer ignores default timeout. Thanks for the report and patch, Christopher Lenz

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.