Source of file AbstractAdapter.php
Size: 1,660 Bytes - Last Modified: 2017-11-08T13:54:24+00:00
/home/travis/build/bluzphp/framework/src/Session/Adapter/AbstractAdapter.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 | <?php /** * Bluz Framework Component * * @copyright Bluz PHP Team * @link https://github.com/bluzphp/framework */ declare(strict_types=1); namespace Bluz\Session\Adapter; /** * Abstract session handler * * @package Bluz\Session\Adapter */ abstract class AbstractAdapter { /** * @var mixed instance of Redis or Cache or some other */ protected $handler = null; /** * @var string prefix for session store */ protected $prefix = 'PHPSESSID:'; /** * @var integer TTL of session */ protected $ttl = 1800; /** * Prepare Id - add prefix * * @param string $id * * @return string */ protected function prepareId($id) { return $this->prefix . $id; } /** * Initialize session * * @param string $savePath * @param string $sessionName * * @return bool */ public function open($savePath, $sessionName) { $this->prefix = $sessionName . ':'; $this->ttl = (int)ini_get('session.gc_maxlifetime'); // No more action necessary because connection is injected // in constructor and arguments are not applicable. return true; } /** * Close the session * * @return bool */ public function close() { $this->handler = null; unset($this->handler); return true; } /** * Cleanup old sessions * * @param integer $maxLifetime * * @return bool */ public function gc($maxLifetime) { // no action necessary because using EXPIRE return true; } } |