Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Mike Willbanks' Blog:
Zend Framework Cache Backend Libmemcached + Session Cache
Oct 25, 2010 @ 15:13:11

Mike Willbanks has a new tutorial posted to his blog today about combining memcache and the Zend Framework's caching component to work with session handling.

If I haven’t said it before, I suppose I will say it now, I love memcached; it is a wonderful tool to have in your tool belt. However, Zend Framework does not currently have an official cache adapter for Memcached (it has one for the extension memcache but not memcached). [...] About 6-9 months ago, I had implemented a Session_SaveHandler_Cache (although it seems some others have as well), to plug this all in together and keep things consistent in a ZF application. It now enables us to utilize the consistent hashing from the Libmemcached adapter by using the PHP Memcached extension.

He moves on into the details of how to save session information into the memcache with a Zend Framework application, using a Zend_Session_SaveHandler_Cache component (code included) as a light-weight interface between the caching server and the application. He also includes the configuration you'll need to add to your application.ini, additions to the bootstrap and a neat trick using the Subversion revision to prefix the cache entry name (a "versioned" caching system).

tagged: zendframework cache backend memcache session tutorial

Link:


Trending Topics: