This class is mostly intended for PHP 5.4 but it can be used under PHP 5.3 provided that a polyfill for SessionHandlerInterface is defined by either you or an external package such as symfony/http-foundation.
저자: Daniele Alessandri (suppakilla@gmail.com)
상속: implements SessionHandlerInterface
예제 #1
0
파일: Redis.php 프로젝트: CFLOVEYR/hook
 public function __construct()
 {
     $config = Config::get('redis');
     if (!$config) {
         throw new ServiceUnavailableException("'redis' config key missing.");
     }
     $client = new Predis\Client($config, array('prefix' => 'sessions:'));
     // Set `gc_maxlifetime` to specify a time-to-live of 5 seconds for session keys.
     parent::__construct($client);
     // , array('gc_maxlifetime' => 5)
 }
예제 #2
0
 /**
  * @Inject({
  *     "@redis",
  *     "%session.lifetime%"
  * })
  * @param ClientInterface $client
  * @param int $lifetime
  */
 public function __construct(ClientInterface $client, $lifetime)
 {
     parent::__construct($client, ['gc_maxlifetime' => $lifetime]);
 }