Opened 17 years ago
Closed 17 years ago
#9221 closed (fixed)
Cache Middleware wrong behavior.
| Reported by: | Wonlay | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Cache system) | Version: | dev |
| Severity: | Keywords: | CACHE_MIDDLEWARE_SECONDS, zero | |
| Cc: | wonlay@… | Triage Stage: | Unreviewed |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
When the CACHE_MIDDLEWARE_SECONDS setting is set to zero,
UpdateCacheMiddleware will set a cache item which timeout is 300.
# This line pass timeout=0. cache.set(cache_key, response, timeout) # But in django/core/cache/backends/memcached.py: self._cache.set(smart_str(key), value, timeout or self.default_timeout) # will set the timeout to self.default_timeout, which is 300.
Actually, if CACHE_MIDDLEWARE_SECONDS=0 there is no need to call cache.set(...
Only patch the header max_age to 0 will be OK.
And my patch attached.
Attachments (1)
Change History (3)
by , 17 years ago
| Attachment: | cache_timeout_0_bug.patch added |
|---|
comment:1 by , 17 years ago
| Cc: | added |
|---|
comment:2 by , 17 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
(In [9098]) Fixed #9221 -- Small optimisation to caching middleware handling.
In the slightly unusual case that CACHE_MIDDLEWARE_SECONDS is set to 0, don't
bother storing a copy in the local cache.