Documentation

CRM_Extension_BootCache
in package

Table of Contents

Properties

$data  : mixed
$locked  : mixed

Methods

define()  : mixed
Define a persistent value in the extension's boot-cache.
get()  : mixed
Get the value of $key.
has()  : bool
Determine if $key has been set.
lock()  : mixed
set()  : static
Set a value in the cache.

Properties

Methods

define()

Define a persistent value in the extension's boot-cache.

public define(string $key, mixed $callback) : mixed

This value is retained as part of the boot-cache. It will be loaded very quickly (eg via php op-code caching). However, as a trade-off, you will not be able to change/reset at runtime - it will only reset in response to a system-wide flush or redeployment.

Ex: $mix->define('initTime', function() { return time(); });

Parameters
$key : string
$callback : mixed
Return values
mixed

The value of $callback (either cached or fresh)

get()

Get the value of $key.

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

has()

Determine if $key has been set.

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

set()

Set a value in the cache.

public set(string $key, mixed $value) : static

This operation is only valid on the first page-load when a cache is built.

Parameters
$key : string
$value : mixed
Tags
throws
Exception
Return values
static

        
On this page

Search results