__construct() 공개 메소드

public __construct ( Predis\ClientInterface $client, array $options = [] )
$client Predis\ClientInterface Fully initialized client instance.
$options array Session handler options.
예제 #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]);
 }