class SessionFactory implements SessionFactoryInterface (View source)

Class SessionFactory Base concrete5 session factory.

To add custom handlers, extend this class and for a handler named "custom_test" create a protected method getCustomTestHandler

Properties

protected $app
protected Request deprecated $request

The request object We needed a reference to this object so that we could assign the session object to it.

Methods

__construct(Application $app, Request $request)

SessionFactory constructor.

Session
createSession()

Create a new symfony session object This method MUST NOT start the session.

getFileHandler(array $config)

Create and return a newly built file session handler.

PdoSessionHandler
getDatabaseHandler(array $config)

Create a new database session handler to handle session.

MemcachedSessionHandler
getMemcachedHandler(array $config)

Return a built Memcached session handler.

getDefaultHandler(array $config)

Return the default session handler.

SessionStorageInterface
getSessionStorage(array $config)

Get a session storage object based on configuration.

getSessionHandler(array $config)

Get a new session handler.

Generator|string[]
newMemcachedServers(Memcached $memcached, array $servers)

Generator for only returning hosts that aren't already added to the memcache instance.

getRedisHandler(array $config)

Return a built Redis session handler.

Redis
getRedisInstance(array $servers)

Decides whether to return a Redis Instance or RedisArray Instance depending on the number of servers passed to it.

getRedisServers(array $servers)

No description

Details

__construct(Application $app, Request $request)

SessionFactory constructor.

Parameters

Application $app
Request $request

@deprecated, will be removed

Session createSession()

Create a new symfony session object This method MUST NOT start the session.

Return Value

Session

Exceptions

BindingResolutionException

protected NativeFileSessionHandler getFileHandler(array $config)

Create and return a newly built file session handler.

Parameters

array $config

The concrete.session config item

Return Value

NativeFileSessionHandler

protected PdoSessionHandler getDatabaseHandler(array $config)

Create a new database session handler to handle session.

Parameters

array $config

The concrete.session config item

Return Value

PdoSessionHandler

protected MemcachedSessionHandler getMemcachedHandler(array $config)

Return a built Memcached session handler.

Parameters

array $config

The concrete.session config item

Return Value

MemcachedSessionHandler

protected NativeFileSessionHandler getDefaultHandler(array $config)

Return the default session handler.

Parameters

array $config

The concrete.session config item

Return Value

NativeFileSessionHandler

private SessionStorageInterface getSessionStorage(array $config)

Get a session storage object based on configuration.

Parameters

array $config

Return Value

SessionStorageInterface

private SessionHandlerInterface getSessionHandler(array $config)

Get a new session handler.

Parameters

array $config

The config from our config repository

Return Value

SessionHandlerInterface

Exceptions

RuntimeException

private Generator|string[] newMemcachedServers(Memcached $memcached, array $servers)

Generator for only returning hosts that aren't already added to the memcache instance.

Parameters

Memcached $memcached
array $servers

The servers as described in config

Return Value

Generator|string[]

[ $host, $port, $weight ]

protected RedisSessionHandler getRedisHandler(array $config)

Return a built Redis session handler.

Parameters

array $config

The concrete.session config item

Return Value

RedisSessionHandler

private Redis getRedisInstance(array $servers)

Decides whether to return a Redis Instance or RedisArray Instance depending on the number of servers passed to it.

Parameters

array $servers

The concrete.session.servers or concrete.session.redis.servers config item

Return Value

Redis

| \RedisArray

private getRedisServers(array $servers)

No description

Parameters

array $servers