interface SessionStorageInterface (View source)

internal  
 

Defines persistence and identifier lifecycle operations used by the session facade.

Storage implementations are construction details of {\Lemonade\Framework\Session\SessionFactory}; consumers resolve {\Lemonade\Framework\Session\Contract\SessionInterface} instead.

Methods

void
start()

Initializes the backend before it serves session values

void
bool

Reports whether the backend has been initialized for this request

bool
bool
has(string $key)

Checks whether the backend contains a value for the key

bool
mixed
get(string $key, mixed $default = null)

Reads a value from the backend or returns the supplied fallback

mixed
void
set(string $key, mixed $value)

Persists a value under the key in the active session

void
void
remove(string $key)

Removes the value stored under the key from the active session

void
void
clear()

Removes all values from the active session

void
void

Removes the active record, invalidates its identifier, and expires its browser cookie.

void
void
regenerate(bool $deleteOldSession = true)

Replaces the active identifier and optionally removes its prior record

void

Details

start

void start()

Initializes the backend before it serves session values

Return Value

void

started

bool started()

Reports whether the backend has been initialized for this request

Return Value

bool

has

bool has(string $key)

Checks whether the backend contains a value for the key

Parameters

string $key

Return Value

bool

get

mixed get(string $key, mixed $default = null)

Reads a value from the backend or returns the supplied fallback

Parameters

string $key
mixed $default

Return Value

mixed

set

void set(string $key, mixed $value)

Persists a value under the key in the active session

Parameters

string $key
mixed $value

Return Value

void

remove

void remove(string $key)

Removes the value stored under the key from the active session

Parameters

string $key

Return Value

void

clear

void clear()

Removes all values from the active session

Return Value

void

destroy

void destroy()

Removes the active record, invalidates its identifier, and expires its browser cookie.

A later access starts a new session identity.

Return Value

void

regenerate

void regenerate(bool $deleteOldSession = true)

Replaces the active identifier and optionally removes its prior record

Parameters

bool $deleteOldSession

Return Value

void