Jelix 1.8.14-pre

jCache
in package

Global caching data provided from whatever sources.

Tags
subpackage

cache

since
1.2

Table of Contents

_loadDriver()  : mixed
callback method for jProfiles. internal use.
add()  : bool
add data in the cache.
call()  : mixed
call a specified method/function or get the result from cache. The function must not return false. The result of the function is stored into the cache system, with the function name and other things as key. If the key already exists in the cache, the function is not called and the value is returned directly.
decrement()  : bool
decrement a specific data value by $decvalue.
delete()  : bool
delete a specific data in the cache.
flush()  : bool
clear data in the cache.
garbage()  : bool
remove from the cache data of which TTL was expired.
get()  : mixed
retrieve data in the cache.
getDriver()  : jICacheDriver
load the cache driver.
increment()  : bool
increment a specific data value by $incvalue.
normalizeKey()  : mixed
replace()  : bool
replace a specific data value by $value.
set()  : bool
set a specific data in the cache.
_checkKey()  : mixed
verify the key for a specific data : only a subset of characters are accepted : letters, numbers, '_','/',':','.','-','@','#','&'.
_doFunctionCall()  : mixed
check and call a specified method/function.
_functionToString()  : string
get the method/function full name.

Methods

_loadDriver()

callback method for jProfiles. internal use.

public static _loadDriver(mixed $profile) : mixed
Parameters
$profile : mixed
Tags
Return values
mixed

add()

add data in the cache.

public static add(string $key, mixed $value[, mixed $ttl = null ][, string $profile = '' ]) : bool
Parameters
$key : string

key used for storing data in the cache

$value : mixed

data to add

$ttl : mixed = null

data time expiration. 0 means no expire, use a timestamp UNIX or a delay in secondes which mustn't exceed 30 days i.e 2592000s or a string in date format US

$profile : string = ''

the cache profile name to use. if empty, use the default profile

Tags
throws
jException
Return values
bool

false if failure

call()

call a specified method/function or get the result from cache. The function must not return false. The result of the function is stored into the cache system, with the function name and other things as key. If the key already exists in the cache, the function is not called and the value is returned directly.

public static call(mixed $fn[, array<string|int, mixed> $fnargs = array() ][, mixed $ttl = null ][, string $profile = '' ]) : mixed
Parameters
$fn : mixed

method/function name ($functionName or array($object, $methodName) or array($className, $staticMethodName))

$fnargs : array<string|int, mixed> = array()

arguments used by the method/function

$ttl : mixed = null

data time expiration. 0 means no expire, use a timestamp UNIX or a delay in secondes which mustn't exceed 30 days i.e 2592000s or a string in date format US

$profile : string = ''

the cache profile name to use. if empty, use the default profile

Tags
throws
jException
Return values
mixed

method/function result

decrement()

decrement a specific data value by $decvalue.

public static decrement(string $key[, mixed $decvalue = 1 ][, string $profile = '' ]) : bool
Parameters
$key : string

key used for storing data in the cache

$decvalue : mixed = 1

value used

$profile : string = ''

the cache profile name to use. if empty, use the default profile

Tags
Return values
bool

false if failure

delete()

delete a specific data in the cache.

public static delete(string $key[, string $profile = '' ]) : bool
Parameters
$key : string

key used for storing data in the cache

$profile : string = ''

the cache profil name to use. if empty, use the default profile

Tags
Return values
bool

false if failure

flush()

clear data in the cache.

public static flush([string $profile = '' ]) : bool
Parameters
$profile : string = ''

the cache profile name to use. if empty, use the default profile

Tags
Return values
bool

false if failure

garbage()

remove from the cache data of which TTL was expired.

public static garbage([string $profile = '' ]) : bool
Parameters
$profile : string = ''

the cache profile name to use. if empty, use the default profile

Tags
Return values
bool

false if failure

get()

retrieve data in the cache.

public static get(mixed $key[, string $profile = '' ]) : mixed
Parameters
$key : mixed

key or array of keys used for storing data in the cache

$profile : string = ''

the cache profile name to use. if empty, use the default profile

Tags
Return values
mixed

$data data stored. False if not found

getDriver()

load the cache driver.

public static getDriver(string $profile) : jICacheDriver

get an instance of driver according the settings in the profile file

Parameters
$profile : string

profile name

Tags
Return values
jICacheDriver

increment()

increment a specific data value by $incvalue.

public static increment(string $key[, mixed $incvalue = 1 ][, string $profile = '' ]) : bool
Parameters
$key : string

key used for storing data in the cache

$incvalue : mixed = 1

value used

$profile : string = ''

the cache profile name to use. if empty, use the default profile

Tags
Return values
bool

false if failure

normalizeKey()

public static normalizeKey(mixed $key) : mixed
Parameters
$key : mixed
Tags
Return values
mixed

replace()

replace a specific data value by $value.

public static replace(string $key, mixed $value[, mixed $ttl = null ][, string $profile = '' ]) : bool
Parameters
$key : string

key used for storing data in the cache

$value : mixed

data to replace

$ttl : mixed = null

data time expiration. 0 means no expire, use a timestamp UNIX or a delay in secondes which mustn't exceed 30 days i.e 2592000s or a string in date format US

$profile : string = ''

the cache profile name to use. if empty, use the default profile

Tags
throws
jException
Return values
bool

false if failure

set()

set a specific data in the cache.

public static set(string $key, mixed $value[, mixed $ttl = null ][, string $profile = '' ]) : bool
Parameters
$key : string

key used for storing data

$value : mixed

data to store

$ttl : mixed = null

data time expiration. 0 means no expire, use a timestamp UNIX or a delay in secondes which mustn't exceed 30 days i.e 2592000s or a string in date format US

$profile : string = ''

the cache profile name to use. if empty, use the default profile

Tags
throws
jException
Return values
bool

false if failure

_checkKey()

verify the key for a specific data : only a subset of characters are accepted : letters, numbers, '_','/',':','.','-','@','#','&'.

protected static _checkKey(string $key) : mixed

no space.

db, redis: any characters memcache: no space, no control char (\t \n \00) file: any (key is hashed with md5)

Parameters
$key : string

key used for storing data

Tags
throws
jException
Return values
mixed

_doFunctionCall()

check and call a specified method/function.

protected static _doFunctionCall(mixed $fn, array<string|int, mixed> $fnargs) : mixed
Parameters
$fn : mixed

method/function name

$fnargs : array<string|int, mixed>

arguments used by the method/function

Tags
throws
jException
Return values
mixed

$data method/function result

_functionToString()

get the method/function full name.

protected static _functionToString(mixed $fn) : string
Parameters
$fn : mixed

method/function name

Tags
Return values
string

$fnname method/function name

Search results