Add memcache cache handler function
author Chris Han
committer Chris Han
commit f5876e5741754e3b19835276129e56f0bc693e14
tree fdb6d5af98fede64d78972dcc0f73d762686a338
parent db3ff20bc5a982ea0655529034ffce83e48301df
Add memcache cache handler function

There is an existing smarty memcache cache handler function out there,
however examples I've seen out there are incomplete in that they only
support evicting items from the cache using an exact key. However,
GitPHP takes advantage of some of the more advanced cache expiration
features of smarty, such as using cache groups and expiration based on
cache age.
Therefore this is an implementation done by me from scratch to support
these extra cache expiration mechanisms. Memcache doesn't inherently
support things like iterating over stored keys and getting the age of
a stored item. Therefore, I'm using a hack, where I maintain a mapping
table of stored keys and cache ages in a fixed key, and update that key
manually and use it for cache group or age expiration.
This also provides a memcache wrapper class to be able to transparently
support both the PECL Memcache and PECL Memcached extensions using the
same functions.
include/cache/Memcache.class.php [ new file with mode 0644 ]
include/cache/memcache_cache_handler.php [ new file with mode 0644 ]