RedisSessionFactory
session slot factory for RedisSessionPersistence.
yaml session: class: Quiote\Session\Redis\RedisSessionFactory params: dsn: 'redis://127.0.0.1:6379' prefix: 'session:' ttl: 1440
Redis expires the key itself, so ttl doubles as the session lifetime and there is no garbage-collection pass to schedule.
Synopsis
Section titled “Synopsis”final class RedisSessionFactory implements SessionFactoryInterface
| Implements | SessionFactoryInterface |
| Since | 3.0.0 |
| Source | RedisSessionFactory.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
createPersistence(Context $context, array $parameters): SessionPersistenceInterface | Builds a RedisSessionPersistence over a Predis client. |
createPersistence()
Section titled “createPersistence()”public function createPersistence(Context $context, array $parameters): SessionPersistenceInterface
Builds a RedisSessionPersistence over a Predis client.
Parameters, all optional: dsn (default redis://127.0.0.1:6379), prefix (default session:) and ttl in seconds (default 1440), which Redis enforces as the session lifetime.
| Parameter | Type | Description |
|---|---|---|
$context | Context | |
$parameters | array |
Returns SessionPersistenceInterface
| Throws | When |
|---|---|
RuntimeException | if predis/predis is not installed. |