Opened 16 years ago
Closed 16 years ago
#9761 closed (wontfix)
Enhancement CacheBackend API
Reported by: | fero | Owned by: | nobody |
---|---|---|---|
Component: | Core (Cache system) | Version: | 1.0 |
Severity: | Keywords: | cache API | |
Cc: | luca.ferroni@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In order to make the CacheBackend easily used by custom cache middleware component (which is application aware),
I think it should be appropriate to add two methods
when_cached(self, key) --> the timestamp of the cached key if present, 0 otherwise get_if_newer(self, key, timestamp) --> get only if "when_cached" timestamp is more than the timestamp in input
The former is a MUST to implement custom cache middleware,
the latter is a BONUS but is trivial to implement it in custom cache middleware too (if the first is present)
I attach a patch to filebased.py CacheClass in order to show the implementation for file based cache
Attachments (1)
Change History (2)
by , 16 years ago
Attachment: | filebased.patch added |
---|
comment:1 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
This can't be done in a way that'll work for all cache backends -- memcached, for example, can't support this -- and we need to support a common API.
filebased cache patch example for extending the cachebackends API