Psr6Store
in package
implements
StoreInterface
The PSR-6 store needs a PSR-6 CacheItemPool and a public StoreInterface (e.g. CookieStore).
The public store is used to store the cache key and the private PSR-6 store is for the actual user data.
Tags
Interfaces, Classes, Traits and Enums
- StoreInterface
- Interface StoreInterface.
Table of Contents
- $privateStore : CacheItemPoolInterface
- $publicStore : StoreInterface
- $storageKey : string
- __construct() : mixed
- Psr6Store constructor.
- defer() : void
- This has no effect when using PSR-6 as the storage medium.
- delete() : void
- Removes a value identified by $key.
- get() : mixed
- Gets persisted values identified by $key.
- purge() : void
- Removes all values.
- set() : void
- Persists $value on $_SESSION, identified by $key.
- generateKey() : string
- Generate a cryptographically-secure random string.
- getCacheKey() : string
- Generate a cryptographically-secure random string.
Properties
$privateStore
private
CacheItemPoolInterface
$privateStore
$publicStore
private
StoreInterface
$publicStore
$storageKey
private
string
$storageKey
= 'storage_key'
Methods
__construct()
Psr6Store constructor.
public
__construct(StoreInterface $publicStore, CacheItemPoolInterface $privateStore[, string $storageKey = 'storage_key' ]) : mixed
Parameters
- $publicStore : StoreInterface
-
an instance of StoreInterface to use for 'public' storage
- $privateStore : CacheItemPoolInterface
-
an instance of CacheItemPoolInterface to use for 'private' storage
- $storageKey : string = 'storage_key'
-
a string representing the key/namespace under which to store values
Return values
mixed —defer()
This has no effect when using PSR-6 as the storage medium.
public
defer(bool $deferring) : void
Parameters
- $deferring : bool
-
whether to defer persisting the storage state
Tags
Return values
void —delete()
Removes a value identified by $key.
public
delete(string $key) : void
Parameters
- $key : string
-
session key to delete
Return values
void —get()
Gets persisted values identified by $key.
public
get(string $key[, mixed $default = null ]) : mixed
If the value is not set, returns $default.
Parameters
- $key : string
-
session key to set
- $default : mixed = null
-
default to return if nothing was found
Return values
mixed —purge()
Removes all values.
public
purge() : void
Return values
void —set()
Persists $value on $_SESSION, identified by $key.
public
set(string $key, mixed $value) : void
Parameters
- $key : string
-
session key to set
- $value : mixed
-
value to use
Return values
void —generateKey()
Generate a cryptographically-secure random string.
private
generateKey() : string
Tags
Return values
string —getCacheKey()
Generate a cryptographically-secure random string.
private
getCacheKey() : string