FileStore
in package
implements
Store
Uses
InteractsWithTime, RetrievesMultipleKeys
Interfaces, Classes and Traits
Table of Contents
- $directory : string
- The file cache directory.
- $files : Filesystem
- The Illuminate Filesystem instance.
- __construct() : void
- Create a new file cache store instance.
- decrement() : int
- Decrement the value of an item in the cache.
- flush() : bool
- Remove all items from the cache.
- forever() : void
- Store an item in the cache indefinitely.
- forget() : bool
- Remove an item from the cache.
- get() : mixed
- Retrieve an item from the cache by key.
- getDirectory() : string
- Get the working directory of the cache.
- getFilesystem() : Filesystem
- Get the Filesystem instance.
- getPrefix() : string
- Get the cache key prefix.
- increment() : int
- Increment the value of an item in the cache.
- many() : array<string|int, mixed>
- Retrieve multiple items from the cache by key.
- put() : void
- Store an item in the cache for a given number of minutes.
- putMany() : void
- Store multiple items in the cache for a given number of minutes.
- availableAt() : int
- Get the "available at" UNIX timestamp.
- currentTime() : int
- Get the current system time as a UNIX timestamp.
- emptyPayload() : array<string|int, mixed>
- Get a default empty payload for the cache.
- ensureCacheDirectoryExists() : void
- Create the file cache directory if necessary.
- expiration() : int
- Get the expiration time based on the given minutes.
- getPayload() : array<string|int, mixed>
- Retrieve an item and expiry time from the cache by key.
- parseDateInterval() : DateTimeInterface|int
- If the given value is an interval, convert it to a DateTime instance.
- path() : string
- Get the full path for the given cache key.
- secondsUntil() : int
- Get the number of seconds until the given DateTime.
Properties
$directory
The file cache directory.
protected
string
$directory
$files
The Illuminate Filesystem instance.
protected
Filesystem
$files
Methods
__construct()
Create a new file cache store instance.
public
__construct(Filesystem $files, string $directory) : void
Parameters
- $files : Filesystem
- $directory : string
Return values
void —decrement()
Decrement the value of an item in the cache.
public
decrement(string $key[, mixed $value = 1 ]) : int
Parameters
- $key : string
- $value : mixed = 1
Return values
int —flush()
Remove all items from the cache.
public
flush() : bool
Return values
bool —forever()
Store an item in the cache indefinitely.
public
forever(string $key, mixed $value) : void
Parameters
- $key : string
- $value : mixed
Return values
void —forget()
Remove an item from the cache.
public
forget(string $key) : bool
Parameters
- $key : string
Return values
bool —get()
Retrieve an item from the cache by key.
public
get(string|array<string|int, mixed> $key) : mixed
Parameters
- $key : string|array<string|int, mixed>
Return values
mixed —getDirectory()
Get the working directory of the cache.
public
getDirectory() : string
Return values
string —getFilesystem()
Get the Filesystem instance.
public
getFilesystem() : Filesystem
Return values
Filesystem —getPrefix()
Get the cache key prefix.
public
getPrefix() : string
Return values
string —increment()
Increment the value of an item in the cache.
public
increment(string $key[, mixed $value = 1 ]) : int
Parameters
- $key : string
- $value : mixed = 1
Return values
int —many()
Retrieve multiple items from the cache by key.
public
many(array<string|int, mixed> $keys) : array<string|int, mixed>
Items not found in the cache will have a null value.
Parameters
- $keys : array<string|int, mixed>
Return values
array<string|int, mixed> —put()
Store an item in the cache for a given number of minutes.
public
put(string $key, mixed $value, float|int $minutes) : void
Parameters
- $key : string
- $value : mixed
- $minutes : float|int
Return values
void —putMany()
Store multiple items in the cache for a given number of minutes.
public
putMany(array<string|int, mixed> $values, float|int $minutes) : void
Parameters
- $values : array<string|int, mixed>
- $minutes : float|int
Return values
void —availableAt()
Get the "available at" UNIX timestamp.
protected
availableAt(DateTimeInterface|DateInterval|int $delay) : int
Parameters
- $delay : DateTimeInterface|DateInterval|int
Return values
int —currentTime()
Get the current system time as a UNIX timestamp.
protected
currentTime() : int
Return values
int —emptyPayload()
Get a default empty payload for the cache.
protected
emptyPayload() : array<string|int, mixed>
Return values
array<string|int, mixed> —ensureCacheDirectoryExists()
Create the file cache directory if necessary.
protected
ensureCacheDirectoryExists(string $path) : void
Parameters
- $path : string
Return values
void —expiration()
Get the expiration time based on the given minutes.
protected
expiration(float|int $minutes) : int
Parameters
- $minutes : float|int
Return values
int —getPayload()
Retrieve an item and expiry time from the cache by key.
protected
getPayload(string $key) : array<string|int, mixed>
Parameters
- $key : string
Return values
array<string|int, mixed> —parseDateInterval()
If the given value is an interval, convert it to a DateTime instance.
protected
parseDateInterval(DateTimeInterface|DateInterval|int $delay) : DateTimeInterface|int
Parameters
- $delay : DateTimeInterface|DateInterval|int
Return values
DateTimeInterface|int —path()
Get the full path for the given cache key.
protected
path(string $key) : string
Parameters
- $key : string
Return values
string —secondsUntil()
Get the number of seconds until the given DateTime.
protected
secondsUntil(DateTimeInterface|DateInterval|int $delay) : int
Parameters
- $delay : DateTimeInterface|DateInterval|int