Skip to content

Commit

Permalink
add prefix for RedisClusterSessionHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
walkor authored Sep 25, 2020
1 parent 6223a0a commit c228ced
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/RedisClusterSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@ public function __construct($config)
{
$this->_maxLifeTime = (int)ini_get('session.gc_maxlifetime');
$timeout = $config['timeout'] ?? 2;
$read_timeout = $config['read_timeout'] ?? $timeout;
$persistent = $config['persistent'] ?? false;
$auth = $config['auth'] ?? '';
$args = [null, $config['host'], $timeout, $timeout, $persistent];
$args = [null, $config['host'], $timeout, $read_timeout, $persistent];
if ($auth) {
$args[] = $auth;
}
$this->_redis = new \RedisCluster(...$args);
if (empty($config['prefix'])) {
$config['prefix'] = 'redis_session_';
}
$this->_redis->setOption(\Redis::OPT_PREFIX, $config['prefix']);
}

}
}

0 comments on commit c228ced

Please sign in to comment.