I want to save zend session in memcache
rather than files
bases session management. I have correctly added memcache.dll
file in Windows 8 x64 system and check that memcache
is working fine and have also installed memcached
and windows services showing memcached Server
running.
I have searched so far for managing Zend session save handler class. I found one good, may be best in my search, article by Mike Willbanks and here is a link. Also I am pasting here that class name of Zend session save handler which is using Memcache.
class Zend_Session_SaveHandler_Cache implements Zend_Session_SaveHandler_Interface {
....
}
Have anybody implemented this session save handler before? If yes then please help me.
Would you please share Zend session save handler
a class, what your using, application.ini settings and Bootstrap.php settings?
Thanks in advance.
I found a solution to manage sessions for sub domains.
What I did is I placed below three lines in .htaccess
file to manage sessions on Memcache
rather than files
based sessions. That means no need to make changes in php.ini
file.
Memcache option
php_value session.cookie_domain "{your_domain}"
php_value session.save_handler "memcache"
php_value session.save_path "tcp://{host}:11211" #127.0.0.1:11211
By doing this no need to write separate handler for sessions management.
Memcached option
In Memcached
there is slight different to specify save_path
like below.
php_value session.cookie_domain "{your_domain}"
php_value session.save_handler "memcached"
php_value session.save_path "{host}:11211" #127.0.0.1:11211
Make sure that Memcached
server is running.
I found little more performance while accessing session from Memcache
or Memcached
instead of accessing session from files
based approach.