File
in package
implements
CacheDriver
File-based Cache driver.
Table of Contents
Interfaces
- CacheDriver
- Cache driver interface.
Properties
- $directory : mixed
Methods
- __construct() : mixed
- Tests that the storage location is a directory and is writable.
- delete() : bool
- Delete cache items by id or tag.
- deleteExpired() : void
- Deletes all expired cache items.
- exists() : array<string|int, mixed>
- Finds an array of files matching the given id or tag.
- find() : array<string|int, mixed>
- Find all of the cache ids for a given tag.
- get() : mixed
- Get a cache item.
- set() : mixed
- Sets a cache item to the given data, tags, and lifetime.
- expired() : bool
- Check if a cache file has expired by filename.
Properties
$directory
protected
mixed
$directory
= ''
Methods
__construct()
Tests that the storage location is a directory and is writable.
public
__construct(mixed $directory) : mixed
Parameters
- $directory : mixed
delete()
Delete cache items by id or tag.
public
delete(mixed $id[, mixed $tag = false ]) : bool
Parameters
- $id : mixed
-
true to delete all items
- $tag : mixed = false
-
set true to delete by tag
Tags
Return values
booldeleteExpired()
Deletes all expired cache items.
public
deleteExpired() : void
Tags
exists()
Finds an array of files matching the given id or tag.
public
exists(string|true $id[, bool $tag = false ]) : array<string|int, mixed>
Parameters
- $id : string|true
-
Cache id or tag, set TRUE to delete all items
- $tag : bool = false
-
Search for tags
Return values
array<string|int, mixed> —of filenames matching the id or tag
find()
Find all of the cache ids for a given tag.
public
find(mixed $tag) : array<string|int, mixed>
Parameters
- $tag : mixed
Tags
Return values
array<string|int, mixed> —[ id => data ]
get()
Get a cache item.
public
get(mixed $id) : mixed
Parameters
- $id : mixed
Tags
set()
Sets a cache item to the given data, tags, and lifetime.
public
set(mixed $id, mixed $data[, array<string|int, mixed>|null $tags = null ][, mixed $lifetime = 0 ]) : mixed
Parameters
- $id : mixed
- $data : mixed
- $tags : array<string|int, mixed>|null = null
- $lifetime : mixed = 0
-
in seconds
Tags
expired()
Check if a cache file has expired by filename.
protected
expired(string $file) : bool
Parameters
- $file : string
-
Filename