RedisSessionStorage
final class RedisSessionStorage implements SessionStorageInterface (View source)
Persists sliding sessions in Redis and delegates physical cleanup to key TTL.
Concurrent payload mutations use last-writer-wins semantics.
Methods
Defines the Redis endpoint, key namespace, sliding retention, and browser identity.
Loads and touches a live key or replaces a missing identity with a fresh TTL-backed key.
Reports whether this request has established its Redis-backed identity.
Checks the payload loaded for this request.
Returns a loaded value or the supplied fallback.
Stores a value with a renewed Redis TTL.
Removes one value and renews the Redis TTL.
Persists an empty payload while retaining the active key and cookie.
Deletes and verifies the active key, then expires its browser cookie.
Copies the payload to a fresh TTL-backed key and optionally invalidates the old key.
Details
__construct
__construct(string $host = '127.0.0.1', int $port = 6379, int $database = 0, string|null $password = null, string $prefix = 'sess:', int $lifetimeSeconds = 7200, string $cookieName = 'LEMONADE_SESSION', float $timeout = 2.5, SessionCookie|null $cookie = null, Closure|null $clientFactory = null)
Defines the Redis endpoint, key namespace, sliding retention, and browser identity.
start
void
start()
Loads and touches a live key or replaces a missing identity with a fresh TTL-backed key.
started
bool
started()
Reports whether this request has established its Redis-backed identity.
has
bool
has(string $key)
Checks the payload loaded for this request.
get
mixed
get(string $key, mixed $default = null)
Returns a loaded value or the supplied fallback.
set
void
set(string $key, mixed $value)
Stores a value with a renewed Redis TTL.
remove
void
remove(string $key)
Removes one value and renews the Redis TTL.
clear
void
clear()
Persists an empty payload while retaining the active key and cookie.
destroy
void
destroy()
Deletes and verifies the active key, then expires its browser cookie.
regenerate
void
regenerate(bool $deleteOldSession = true)
Copies the payload to a fresh TTL-backed key and optionally invalidates the old key.