Pickles Framework Documentation

FileSessionStorage
in package
implements SessionStorage

Table of Contents

Interfaces

SessionStorage
Interface SessionStorage

Properties

$cachedFiles  : array<string|int, mixed>
$filesPath  : string

Methods

destroy()  : bool
Destroys the current session and clears all session data.
generateSessionId()  : string
get()  : mixed
Retrieves a value from the session storage by its key.
getFilePath()  : string
has()  : bool
Checks if a specific key exists in the session storage.
id()  : string
Retrieves the current session ID.
read()  : string
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.
write()  : mixed

Properties

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.

generateSessionId()

public generateSessionId([int $num_bytes = 4 ]) : string
Parameters
$num_bytes : int = 4
Return values
string

get()

Retrieves a value from the session storage by its key.

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

The key associated with the value to retrieve.

$default : mixed = 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.

getFilePath()

public getFilePath([string $sessionId = $this->id() ]) : string
Parameters
$sessionId : string = $this->id()
Return values
string

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.

read()

public read([string $sessionId = $this->id() ]) : string
Parameters
$sessionId : string = $this->id()
Return values
string

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