SessionStore
class SessionStore implements Store (View source)
Traits
Properties
string | $key | The key for cache items. |
|
Session | $session | The session instance. |
Methods
Get the number of seconds until the given DateTime.
If the given value is an interval, convert it to a DateTime instance.
Given a start time, format the total run time for human readability.
Store multiple items in the cache for a given number of seconds.
Get all of the cached values and their expiration times.
Retrieve an item from the cache by key.
Determine if the given expiration time is expired.
Store an item in the cache for a given number of seconds.
Get the UNIX timestamp, with milliseconds, for the given number of seconds in the future.
Increment the value of an item in the cache.
Decrement the value of an item in the cache.
Store an item in the cache indefinitely.
Remove an item from the cache.
Remove all items from the cache.
Get the cache key prefix.
Get the cache key prefix.
Details
protected int
secondsUntil(DateTimeInterface|DateInterval|int $delay)
Get the number of seconds until the given DateTime.
protected int
availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Get the "available at" UNIX timestamp.
protected DateTimeInterface|int
parseDateInterval(DateTimeInterface|DateInterval|int $delay)
If the given value is an interval, convert it to a DateTime instance.
protected int
currentTime()
Get the current system time as a UNIX timestamp.
protected string
runTimeForHumans(float $startTime, float|null $endTime = null)
Given a start time, format the total run time for human readability.
array
many(array $keys)
Retrieve multiple items from the cache by key.
Items not found in the cache will have a null value.
bool
putMany(array $values, int $seconds)
Store multiple items in the cache for a given number of seconds.
__construct(Session $session, string $key = '_cache')
Create a new session cache store.
all()
Get all of the cached values and their expiration times.
mixed
get(string $key)
Retrieve an item from the cache by key.
protected bool
isExpired(int|float $expiresAt)
Determine if the given expiration time is expired.
bool
put(string $key, mixed $value, int $seconds)
Store an item in the cache for a given number of seconds.
protected float
toTimestamp(int $seconds)
Get the UNIX timestamp, with milliseconds, for the given number of seconds in the future.
int|bool
increment(string $key, mixed $value = 1)
Increment the value of an item in the cache.
int|bool
decrement(string $key, mixed $value = 1)
Decrement the value of an item in the cache.
bool
forever(string $key, mixed $value)
Store an item in the cache indefinitely.
bool
forget(string $key)
Remove an item from the cache.
bool
flush()
Remove all items from the cache.
string
itemKey($key)
Get the cache key prefix.
string
getPrefix()
Get the cache key prefix.