File
class File extends Store
File store.
Properties
protected string|null | $prefix | Prefix. | from Store |
protected FileSystem | $fileSystem | File system instance. | |
protected string | $cachePath | Cache path. | |
protected bool|array | $classWhitelist | Class whitelist. |
Methods
Store data in the cache if it doesn't already exist.
Fetch data from the cache and replace it.
Fetch data from the cache or store it if it doesn't already exist.
Constructor.
Returns the path to the cache file.
Store data in the cache.
Returns TRUE if the cache key exists and FALSE if not.
Fetch data from the cache.
Delete data from the cache.
Clears the cache.
Details
in Store at line 30
$this
setPrefix(string $prefix)
Sets the cache key prefix.
in Store at line 42
string|null
getPrefix()
Returns the cache key prefix.
in Store at line 53
protected string
getPrefixedKey(string $key)
Returns a prefixed key.
in Store at line 61
bool
putIfNotExists(string $key, mixed $data, int $ttl = 0)
Store data in the cache if it doesn't already exist.
in Store at line 79
mixed
getAndPut(string $key, mixed $data, int $ttl = 0)
Fetch data from the cache and replace it.
in Store at line 94
mixed
getAndRemove(string $key)
Fetch data from the cache and remove it.
in Store at line 109
mixed
getOrElse(string $key, callable $data, int $ttl = 0)
Fetch data from the cache or store it if it doesn't already exist.
at line 55
__construct(FileSystem $fileSystem, string $cachePath, bool|array $classWhitelist = false)
Constructor.
at line 70
protected string
cacheFile(string $key)
Returns the path to the cache file.
at line 78
bool
put(string $key, mixed $data, int $ttl = 0)
Store data in the cache.
at line 90
bool
has(string $key)
Returns TRUE if the cache key exists and FALSE if not.
at line 109
mixed
get(string $key)
Fetch data from the cache.
at line 154
bool
remove(string $key)
Delete data from the cache.
at line 167
bool
clear()
Clears the cache.