FilesystemCache
in package
implements
CacheInterface
Filesystem cache driver.
Table of Contents
Interfaces
- CacheInterface
- Cache interface
Constants
- FILE_EXTENSION = '.cache'
Properties
- $cacheDir : string
- Cache directory
- $options : array<string|int, mixed>
- Driver options
- $umask : mixed
- File umask
Methods
- __construct() : mixed
- Constructor
- clear() : bool
- Delete all cache items.
- delete() : bool
- Delete cache entry.
- fetch() : mixed|false
- Fetch entry.
- getStats() : array<string|int, mixed>|null
- Return cache stats
- has() : bool
- Check if cache contains item
- save() : bool
- Save data into the cache.
- getFilename() : string
- Get cache file name
Constants
FILE_EXTENSION
public
mixed
FILE_EXTENSION
= '.cache'
Properties
$cacheDir
Cache directory
protected
string
$cacheDir
$options
Driver options
protected
array<string|int, mixed>
$options
$umask
File umask
protected
mixed
$umask
Methods
__construct()
Constructor
public
__construct(string $cacheDir[, array<string|int, mixed> $options = [] ][, int $umask = 02 ]) : mixed
Parameters
- $cacheDir : string
- $options : array<string|int, mixed> = []
- $umask : int = 02
clear()
Delete all cache items.
public
clear() : bool
Return values
booldelete()
Delete cache entry.
public
delete(string $id) : bool
Parameters
- $id : string
-
cache id.
Return values
boolfetch()
Fetch entry.
public
fetch(string $id) : mixed|false
Parameters
- $id : string
Return values
mixed|false —The cached data or false
getStats()
Return cache stats
public
getStats() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullhas()
Check if cache contains item
public
has(string $id) : bool
Parameters
- $id : string
Return values
boolsave()
Save data into the cache.
public
save(string $id, mixed $data[, int $lifeTime = 0 ]) : bool
Parameters
- $id : string
-
The cache id.
- $data : mixed
-
The cache entry/data.
- $lifeTime : int = 0
Return values
bool —true if data was successfully stored in the cache, false otherwise.
getFilename()
Get cache file name
protected
getFilename(string $id) : string
Parameters
- $id : string