Cache backend API should close()
|Reported by:||russellm||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:2 follow-up: ↓ 3 Changed 3 years ago by russellm
- Needs tests set
- Patch needs improvement set
comment:5 Changed 3 years ago by russellm
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Accepted to Ready for checkin