Skip to content

Instantly share code, notes, and snippets.

@eminetto
Created May 23, 2011 19:40
Show Gist options
  • Save eminetto/987410 to your computer and use it in GitHub Desktop.
Save eminetto/987410 to your computer and use it in GitHub Desktop.
class Xorna_Session_Handler implements Zend_Session_SaveHandler_Interface{
        private $maxlifetime = 3600;
        public $cache = '';    
       
        public function __construct($cacheHandler) {
                $this->cache = $cacheHandler;
        }
        public function open($save_path, $name) {
                return true;
        }
        public function close() {
                return true;
        }
        public function read($id) {
                if(!($data = $this->cache->load($id))) {
                        return '';
                }
                else {
                        return $data;
                }
        }
        public function write($id, $sessionData) {
                $this->cache->save($sessionData, $id, array(), $this->maxlifetime);
                return true;
        }
        public function destroy($id) {
                $this->cache->remove($id);
                return true;
        }
        public function gc($notusedformemcache) {
                return true;
        }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment