FileCache
+ Inheritance diagram for FileCache:

Description

An optional bare bones PSR-16 "compliant" file-based cache for SimpleCachePool.

Requires psr/simple-cache (any version).

This is not safe for concurrency.

Don't use this if you have a better cache.

Public Methods

 __construct (string $dir)
 
bool clear ()
 Does nothing. More...
 
bool delete ($key)
 CacheInterface:1|2 compatible params. More...
 
bool deleteMultiple ($keys)
 CacheInterface:1|2 compatible params. More...
 
string object mixed get ($key, $default=null)
 CacheInterface:1|2 compatible params. More...
 
array getMultiple ($keys, $default=null)
 CacheInterface:1|2 compatible params. More...
 
bool has ($key)
 CacheInterface:1|2 compatible params. More...
 
bool set ($key, $value, $ttl=null)
 CacheInterface:1|2 compatible params. More...
 
$this setLog (?LoggerInterface $log)
 
bool setMultiple ($values, $ttl=null)
 CacheInterface:1|2 compatible params. More...
 

Constructor

◆ __construct()

__construct ( string  $dir)
Parameters
string$dir

Methods

◆ clear()

bool clear ( )

Does nothing.

Returns
bool false

◆ delete()

bool delete (   $key)

CacheInterface:1|2 compatible params.

Parameters
string$key
Returns
bool

◆ deleteMultiple()

bool deleteMultiple (   $keys)

CacheInterface:1|2 compatible params.

Parameters
iterable$keys
Returns
bool

◆ get()

string object mixed get (   $key,
  $default = null 
)

CacheInterface:1|2 compatible params.

Parameters
string$key
mixed$default
Returns
string|object|mixed $default is the only mixed type returned

◆ getMultiple()

array getMultiple (   $keys,
  $default = null 
)

CacheInterface:1|2 compatible params.

Parameters
iterable$keys
mixed$default
Returns
array

◆ has()

bool has (   $key)

CacheInterface:1|2 compatible params.

This only checks for file existence, regardless of expiration. This is fine, since by principle, cache polling does not guarantee a subsequent hit.

Parameters
string$key
Returns
bool

◆ set()

bool set (   $key,
  $value,
  $ttl = null 
)

CacheInterface:1|2 compatible params.

Parameters
string$key
string | object$value
null | int | DateInterval$ttlNULL is the same as 0 seconds.
Returns
bool

◆ setLog()

$this setLog ( ?LoggerInterface  $log)
Parameters
null | LoggerInterface$log
Returns
$this

◆ setMultiple()

bool setMultiple (   $values,
  $ttl = null 
)

CacheInterface:1|2 compatible params.

Parameters
iterable$values
int | DateInterval$ttlNULL is the same as 0 seconds.
Returns
bool