Pickles Framework Documentation

SessionStorage

Interface SessionStorage

Defines the contract for session storage implementations. Provides methods to manage session lifecycle and data.

Table of Contents

Methods

destroy()  : bool
Destroys the current session and clears all session data.
get()  : mixed
Retrieves a value from the session storage by its key.
has()  : bool
Checks if a specific key exists in the session storage.
id()  : string
Retrieves the current session ID.
remove()  : void
Removes a value from the session storage.
save()  : bool
Saves the current session data to the storage.
set()  : void
Stores a value in the session storage with the specified key.
start()  : void
Starts the session storage mechanism.

Methods

destroy()

Destroys the current session and clears all session data.

public destroy() : bool
Return values
bool

Returns true on success or false on failure.

get()

Retrieves a value from the session storage by its key.

public get(string $key[, mixed|null $default = null ]) : mixed
Parameters
$key : string

The key associated with the value to retrieve.

$default : mixed|null = null

The default value to return if the key does not exist. Defaults to null.

Return values
mixed

The value associated with the given key, or the default value if the key does not exist.

has()

Checks if a specific key exists in the session storage.

public has(string $key) : bool
Parameters
$key : string

The key to check for existence in the session storage.

Return values
bool

Returns true if the key exists, false otherwise.

id()

Retrieves the current session ID.

public id() : string
Return values
string

The session ID.

remove()

Removes a value from the session storage.

public remove(string $key) : void
Parameters
$key : string

The key identifying the value to be removed.

save()

Saves the current session data to the storage.

public save() : bool
Return values
bool

Returns true on success or false on failure.

set()

Stores a value in the session storage with the specified key.

public set(string $key, mixed $value) : void
Parameters
$key : string

The key under which the value will be stored.

$value : mixed

The value to store in the session storage.

start()

Starts the session storage mechanism.

public start() : void

This method is responsible for initializing the session storage, ensuring that the session is ready for use. It should be called before attempting to read or write session data.


        
On this page

Search results