public function write($id, $data) { // get the default session max lifetime $ttl = ini_get("session.gc_maxlifetime"); // use Redis' setex command to set the key value and its expire // time $cmd = new Rediska_Key($id); // the session string is base64 encoded before being stored return (bool) $cmd->SetAndExpire(base64_encode($data), $ttl); }