Skip to content

Instantly share code, notes, and snippets.

@eminetto
Created December 12, 2011 23:32
Show Gist options
  • Save eminetto/1469654 to your computer and use it in GitHub Desktop.
Save eminetto/1469654 to your computer and use it in GitHub Desktop.
<?php
class Blog_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