NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP caching (not opcode)

Patrick May patrick at hexane.org
Fri Jul 18 12:02:43 EDT 2008


> I love the idea of providing the cache with an event model, so that
> you can fire events that invalidate the parts of the cache that are
> listening for them. I haven't ever seen that before, but then again I
> don't get out much. Is it derived from some other system/language?
>

When I was working on caching, I remembered having to implement double
buffering for applets when I was learning to program.  Part of the
abstraction included marking the buffer as "damaged" when something was
drawn on it.  This would trigger an actual re-draw to the screen, when it
was time.

Dealing with caching websites, I found it was useful for the front end to
write caches to disk, and have the backend just delete the cache file.
These apis worked something like:

  <?php
  cache('callback', '/path/to/file')
  // to delete cache...
  @unlink('/path/to/file')
  ?>

The advantage of this technique is that it is very easy to span environments
and applications, since the 'event' is the deleting of a file.  But it can
get annoying making sure each event has the right file deletions.  So then I
started working on the tag / events idea, to make it easier to create the
association.

Cheers,

Patrick

-- 
Patrick May
135 Oak Street
New York, NY 11222
+1 (347) 232-5208
patrick at hexane.org
http://www.hexane.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080718/b623fdb1/attachment.html>


More information about the talk mailing list