FileStore
Implements
Uses
Properties
$directory string
The file cache directory.
$lockDirectory string|null
The file cache lock directory.
$filePermission int|null
Octal representation of the cache file permissions.
Methods
__construct ( Filesystem $files , $directory , $filePermission ) : void
Create a new file cache store instance.
Parameters
- $files Filesystem
- $directory string
- $filePermission int|null
get ( $key ) : mixed
Retrieve an item from the cache by key.
Parameters
- $key string|array
put ( $key , $value , $seconds ) : bool
Store an item in the cache for a given number of seconds.
Parameters
- $key string
- $value mixed
- $seconds int
add ( $key , $value , $seconds ) : bool
Store an item in the cache if the key doesn't exist.
Parameters
- $key string
- $value mixed
- $seconds int
ensureCacheDirectoryExists ( $path ) : void
Create the file cache directory if necessary.
Parameters
- $path string
ensurePermissionsAreCorrect ( $path ) : void
Ensure the created node has the correct permissions.
Parameters
- $path string
increment ( $key , $value ) : int
Increment the value of an item in the cache.
Parameters
- $key string
- $value mixed
decrement ( $key , $value ) : int
Decrement the value of an item in the cache.
Parameters
- $key string
- $value mixed
forever ( $key , $value ) : bool
Store an item in the cache indefinitely.
Parameters
- $key string
- $value mixed
lock ( $name , $seconds , $owner ) : Lock
Get a lock instance.
Parameters
- $name string
- $seconds int
- $owner string|null
restoreLock ( $name , $owner ) : Lock
Restore a lock instance using the owner identifier.
Parameters
- $name string
- $owner string
forget ( $key ) : bool
Remove an item from the cache.
Parameters
- $key string
flush ( ) : bool
Remove all items from the cache.
getPayload ( $key ) : array
Retrieve an item and expiry time from the cache by key.
Parameters
- $key string
emptyPayload ( ) : array
Get a default empty payload for the cache.
path ( $key ) : string
Get the full path for the given cache key.
Parameters
- $key string
expiration ( $seconds ) : int
Get the expiration time based on the given seconds.
Parameters
- $seconds int
getDirectory ( ) : string
Get the working directory of the cache.
setLockDirectory ( $lockDirectory ) : $this
Set the cache directory where locks should be stored.
Parameters
- $lockDirectory string|null
getPrefix ( ) : string
Get the cache key prefix.