FileStore
extends AbstractCache
in package
Table of Contents
- $cacheDir : string
- $cacheFile : string
- $prefix : string
- $ttl : int
- __construct() : mixed
- FileStore constructor.
- delete() : bool
- {@inheritDoc}
- deleteAll() : bool
- Delete all keys.
- get() : mixed
- {@inheritDoc}
- getActualCacheKey() : string
- Get actual cache key with prefix.
- getCacheContents() : array<string|int, mixed>|bool
- Get cache contents.
- getCacheDir() : string
- Get cache dir.
- getCacheFile() : string
- Get cache file.
- getPrefix() : string
- Get cache prefix.
- getTtl() : int
- Get time to live.
- isValid() : bool
- Check if cache is still valid.
- keys() : array<string|int, mixed>
- {@inheritDoc}
- put() : int
- Write the contents of a file with exclusive lock.
- set() : mixed
- {@inheritDoc}
- setCacheDir() : self
- Set cache dir.
- setCacheFile() : self
- Set cache file.
- setPrefix() : Cacheable
- Set cache prefix.
- setTtl() : self
- Set time to live.
- sharedGet() : string
- Get contents of a file with shared access.
- createCacheDir() : void
- Create cache dir if not exists.
- createCacheFile() : void
- Create a cache file.
Properties
$cacheDir
protected
string
$cacheDir
$cacheFile
protected
string
$cacheFile
$prefix
protected
string
$prefix
= 'tus:'
Prefix for cache keys
$ttl
protected
int
$ttl
= 86400
TTL in secs (default 1 day)
Methods
__construct()
FileStore constructor.
public
__construct([string|null $cacheDir = null ][, string|null $cacheFile = null ]) : mixed
Parameters
- $cacheDir : string|null = null
- $cacheFile : string|null = null
Return values
mixed —delete()
{@inheritDoc}
public
delete(string $key) : bool
Parameters
- $key : string
Return values
bool —deleteAll()
Delete all keys.
public
deleteAll(array<string|int, mixed> $keys) : bool
Parameters
- $keys : array<string|int, mixed>
Return values
bool —get()
{@inheritDoc}
public
get(string $key[, bool $withExpired = false ]) : mixed
Parameters
- $key : string
- $withExpired : bool = false
Return values
mixed —getActualCacheKey()
Get actual cache key with prefix.
public
getActualCacheKey(string $key) : string
Parameters
- $key : string
Return values
string —getCacheContents()
Get cache contents.
public
getCacheContents() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool —getCacheDir()
Get cache dir.
public
getCacheDir() : string
Return values
string —getCacheFile()
Get cache file.
public
getCacheFile() : string
Return values
string —getPrefix()
Get cache prefix.
public
getPrefix() : string
Return values
string —getTtl()
Get time to live.
public
getTtl() : int
Return values
int —isValid()
Check if cache is still valid.
public
isValid(string $key) : bool
Parameters
- $key : string
Return values
bool —keys()
{@inheritDoc}
public
keys() : array<string|int, mixed>
Return values
array<string|int, mixed> —put()
Write the contents of a file with exclusive lock.
public
put(string $path, string $contents) : int
Parameters
- $path : string
- $contents : string
Return values
int —set()
{@inheritDoc}
public
set(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
Return values
mixed —setCacheDir()
Set cache dir.
public
setCacheDir(string $path) : self
Parameters
- $path : string
Return values
self —setCacheFile()
Set cache file.
public
setCacheFile(string $file) : self
Parameters
- $file : string
Return values
self —setPrefix()
Set cache prefix.
public
setPrefix(string $prefix) : Cacheable
Parameters
- $prefix : string
Return values
Cacheable —setTtl()
Set time to live.
public
setTtl(int $secs) : self
Parameters
- $secs : int
Return values
self —sharedGet()
Get contents of a file with shared access.
public
sharedGet(string $path) : string
Parameters
- $path : string
Return values
string —createCacheDir()
Create cache dir if not exists.
protected
createCacheDir() : void
Return values
void —createCacheFile()
Create a cache file.
protected
createCacheFile() : void