Documentation

CRM_Utils_Cache_Interface extends CacheInterface
in

Tags
copyright

CiviCRM LLC https://civicrm.org/licensing CRM_Utils_Cache_Interface is a long-standing interface used within CiviCRM for interacting with a cache service. In style and substance, it is extremely similar to PHP-FIG's SimpleCache interface (PSR-16). Consequently, beginning with CiviCRM v5.4, this extends \Psr\SimpleCache\CacheInterface.

see
https://www.php-fig.org/psr/psr-16/

Table of Contents

Methods

clear()  : bool
Delete all values from the cache.
delete()  : bool
Delete a value from the cache.
flush()  : bool
Delete all values from the cache.
get()  : mixed
Get a value from the cache.
has()  : bool
Determines whether an item is present in the cache.
set()  : bool
Set the value in the cache.

Methods

clear()

Delete all values from the cache.

public clear() : bool

NOTE: flush() and clear() should be aliases. flush() is specified by Civi's traditional interface, and clear() is specified by PSR-16.

Tags
see
flush
Return values
bool

delete()

Delete a value from the cache.

public delete(string $key) : bool
Parameters
$key : string
Return values
bool

flush()

Delete all values from the cache.

public flush() : bool

NOTE: flush() and clear() should be aliases. flush() is specified by Civi's traditional interface, and clear() is specified by PSR-16.

Tags
see
clear
Return values
bool

get()

Get a value from the cache.

public get(string $key[, mixed $default = NULL ]) : mixed
Parameters
$key : string
$default : mixed = NULL
Return values
mixed

The previously set value value, or $default (NULL).

has()

Determines whether an item is present in the cache.

public has(string $key) : bool

NOTE: It is recommended that has() is only to be used for cache warming type purposes and not to be used within your live applications operations for get/set, as this method is subject to a race condition where your has() will return true and immediately after, another script can remove it making the state of your app out of date.

Parameters
$key : string

The cache item key.

Return values
bool

set()

Set the value in the cache.

public set(string $key, mixed $value[, null|int|DateInterval $ttl = NULL ]) : bool
Parameters
$key : string
$value : mixed
$ttl : null|int|DateInterval = NULL
Return values
bool

        
On this page

Search results