Cache backend API should close()
|Reported by:||Russell Keith-Magee||Owned by:||nobody|
|Component:||Core (Cache system)||Version:||1.4|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
At present, only the memcached cache backends have a close() method. This means that you can't reliably call close() on a cache -- you need to protect it with "hasattr(cache, 'close')".
Django's own code even does this, in the end-request signal handler.
The cache backend API should include a no-op close() method by default, matching the API from the memcached backend.
The close() method (and the end-request handler) were added in r8418
Change History (6)
comment:5 Changed 4 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Accepted → Ready for checkin|