On Sunday 18 June 2006 4:22 pm, Jason A. Crome wrote:
> Please see the attached RFC.  I know a caching plugin has been
> discussed in the past, but recent needs at work (and recent
> conversations with Cees) have motivated me to produce this.  When you
> have an opportunity, please read and give me your feedback.

Oh, this sounds nice. :))  I'm regularly having to deal with needs to caches 
in various parts of our applications, but having something integrate directly 
with C-A would be -sweet-.

> One thing I have considered adding but have not done so yet is cache
> rollover.  To explain this a bit...  If you look for a parameter in
> an unspecified cache, and the parameter doesn't exist there, you
> search all caches for a match on that parameter.  Which begs the
> question, what should a set operation do?  Set in one cache or all
> caches?  What are your thoughts on this?

I'd written a first response here under the guise of "get should query all, 
set should just set into a single cache", but after further thought think 
that its just not consistent that way.

What about "find()" instead of "get()"?  It'd be syntactically more obvious to 
the reader that "find()" is going to do a search across multiple caches, 
while "get()" is just going to explicitly go get the results from a single 
cache.  I'd envision "find()" just doing an iteration across all registered 
caches until the specified value was found.

Only gotcha I can think of here is how does one set which caches to search and 
in what order?  E.g. what if I want my "memory" cache to be checked before my 
"disk" cache?  what if I'm only concerned about results from my "memory" and 
"memcached" caches and don't care about the "disk" cache right now?

Perhaps something like:

  # create separate "memory", "disk", and "memcached" caches
  $self->cache('memory')->config( ... );
  $self->cache('disk')->config( ... );
  $self->cache('memcached')->config( ... );

  # find a cached item in -ANY- registered cache
  $self->cache->find( $key );

  # find a cached item in a specific set of caches
  $self->cache(['memory','memcached'])->find( $key );

???

Heck.... at that point why not just do...

  $self->cache(['memory','memcached'])->get( $key );

as its pretty obvious that we're doing a "get()" across an explicit set of 
caches.  Maybe:

  $self->cache('*')->get( $key );

to query against "all known caches, in no guaranteed order"?

-- 
Graham TerMarsch
Howling Frog Internet Development, Inc.

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to