note 83096 deleted from function.session-set-save-handler by cmb
| From: | cmb@php.net | Date: | Sun, 24 Nov 2019 09:10:34 +0000 |
| Subject: | note 83096 deleted from function.session-set-save-handler by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213238@lists.php.net to get a copy of this message | ||
Note Submitter: anddriga at gmail dot com
----
Some PHP code for memcached session handler.
<?php
class SessionHadler
{
private static $lifetime = 0;
public static function open()
{
self::$lifetime = ini_get('session.gc_maxlifetime');
return true;
}
public static function read($id)
{
return memcached::get("sessions/{$id}");
}
public static function write($id, $data)
{
return memcached::set("sessions/{$id}", $data, self::$lifetime);
}
public static function destroy($id)
{
return memcached::delete("sessions/{$id}");
}
private function __construct(){}
public static function gc(){ return true; }
public static function close(){ return true; }
public function __destruct()
{
session_write_close();
}
}
?>