ZF-10561: Ability to utilize a Cache for a Session SaveHandler: Zend_Session_SaveHandler_Cache
Description
Utilizing a Cache as a session saveHandler is like having a saveHandler as a database except a bit more flexible.
The cache supports the Zend_Cache_Core frontend and any backend attached to it. This becomes extremely valuable for things like Memcache / Memcached. In a development environment we have even used APC.
Attached is a patch for this improvement that contains the SaveHandler support and tests.
The files are as follows: M tests/Zend/Session/SaveHandler/AllTests.php A tests/Zend/Session/SaveHandler/CacheTest.php A library/Zend/Session/SaveHandler/Cache.php
Comments
Posted by Mike Willbanks (digitalstruct) on 2010-10-15T11:05:17.000+0000
Usage:
Configuration INI File (for Zend_Application): resources.session.saveHandler.class = Zend_Session_SaveHandler_Cache
Bootstrap.php (for Zend_Application):
protected function _initSessionCache() $this->bootstrap('session'); $opts = $this->getOptions(); if ('Zend_Session_SaveHandler_Cache' == $opts['resources']['session']['saveHandler']['class']) { $cache = $this->bootstrap('cachemanager') ->getResource('cachemanager') ->getCache('memcached'); Zend_Session::getSaveHandler()->setCache($cache); } }Posted by Ramon Henrique Ornelas (ramon) on 2010-10-17T05:21:11.000+0000
Hi Mike
There a need of elaborate a propose, but already exists a porpose to this component http://framework.zend.com/wiki/display/….
I have a code similar the this but propose only would accepted until final of August.
Also Zend_Session in ZF2 has changes and Zend_Cache is in phase refactoring.
Greetings Ramon
Posted by Matthew Weier O'Phinney (matthew) on 2010-10-19T09:17:09.000+0000
For the record: the SaveHandler functionality in ZF2 is not much changed, if at all, as it simply provides an interface for building a component that works with session_set_save_handler.
Mike -- I'd forgotten about the cache savehandler, and that it was already accepted. Closing this issue, as it will be implemented for ZF2.