| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2014, The Roundcube Dev Team | |
| | |
| | | | See the README file for a full license statement. | |
| | | | | |
| | | | PURPOSE: | |
| | | | Provide redis supported session management | |
| | | | Provide redis supported session management | |
| | | +-----------------------------------------------------------------------+ |
| | | | Author: Cor Bosman <cor@roundcu.be> | |
| | | +-----------------------------------------------------------------------+ |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * read data from redis store |
| | | * |
| | |
| | | |
| | | return !empty($this->vars) ? (string) $this->vars : ''; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * write data to redis store |
| | |
| | | $ts = microtime(true); |
| | | |
| | | if ($newvars !== $oldvars || $ts - $this->changed > $this->lifetime / 3) { |
| | | $this->redis->setex($key, $this->lifetime + 60, serialize(array('changed' => time(), 'ip' => $this->ip, 'vars' => $newvars))); |
| | | $data = serialize(array('changed' => time(), 'ip' => $this->ip, 'vars' => $newvars)); |
| | | $this->redis->setex($key, $this->lifetime + 60, $data); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * write data to redis store |
| | |
| | | */ |
| | | public function write($key, $vars) |
| | | { |
| | | return $this->redis->setex($key, $this->lifetime + 60, serialize(array('changed' => time(), 'ip' => $this->ip, 'vars' => $vars))); |
| | | $data = serialize(array('changed' => time(), 'ip' => $this->ip, 'vars' => $vars)); |
| | | |
| | | return $this->redis->setex($key, $this->lifetime + 60, $data); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |