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)

filebased.patch (728 bytes ) - added by fero 16 years ago.
filebased cache patch example for extending the cachebackends API

Download all attachments as: .zip

Change History (2)

by fero, 16 years ago

Attachment: filebased.patch added

filebased cache patch example for extending the cachebackends API

comment:1 by Jacob, 16 years ago

Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top