Opened 5 years ago

Closed 5 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: UI/UX:


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 CacheClass in order to show the implementation for file based cache

Attachments (1)

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

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by fero

filebased cache patch example for extending the cachebackends API

comment:1 Changed 5 years ago by jacob

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.