Jelix 1.6.40

redis_extCacheDriver
in package
implements jICacheDriver

Tags
subpackage

cache_plugin

author

Yannick Le Guédart

contributor

Laurent Jouanneau

copyright

2009 Yannick Le Guédart, 2010-2017 Laurent Jouanneau

link
http://www.jelix.org
licence

http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file

Interfaces, Classes and Traits

jICacheDriver
Interface for cache drivers

Table of Contents

$automatic_cleaning_factor  : int
automatic cleaning process 0 means disabled, 1 means systematic cache cleaning of expired data (at each set or add call), greater values mean less frequent cleaning
$enabled  : bool
active cache ?
$ttl  : bool
TTL used
$key_prefix  : string
Key prefix to be added
$key_prefix_flush_method  : mixed
method to flush the keys when key_prefix is used
$profileName  : string
profil name used in the ini file
$redis  : jRedis
__construct()  : mixed
constructor
decrement()  : bool
decrement a specific data value by $var
delete()  : bool
delete a specific data in the cache
flush()  : bool
clear all data in the cache.
garbage()  : bool
remove from the cache data of which TTL was expired element with TTL expired already removed => Nothing to do because redis has an internal garbage mechanism
get()  : mixed
read a specific data in the cache.
getRedis()  : jRedis
Returns the redis api
increment()  : bool
increment a specific data value by $var
replace()  : bool
replace a specific data value by $var
set()  : bool
set a specific data in the cache.
esc()  : mixed
getUsedKey()  : mixed
unesc()  : mixed

Properties

$automatic_cleaning_factor

automatic cleaning process 0 means disabled, 1 means systematic cache cleaning of expired data (at each set or add call), greater values mean less frequent cleaning

public int $automatic_cleaning_factor = 0
Tags
access

public

$enabled

active cache ?

public bool $enabled = rue
Tags
access

public

$key_prefix

Key prefix to be added

protected string $key_prefix = ''
Tags
access

protected

$key_prefix_flush_method

method to flush the keys when key_prefix is used

protected mixed $key_prefix_flush_method = 'direct'

direct: uses SCAN and DEL, but it can take huge time jcacheredisworker: it stores the keys prefix to delete into a redis list named 'jcacheredisdelkeys'. You can use a script to launch a worker which pops from this list prefix of keys to delete, and delete them with SCAN/DEL redis commands. See the redisworker controller in the jelix module. event: send a jEvent. It's up to your application to respond to this event and to implement your prefered method to delete all keys.

$profileName

profil name used in the ini file

protected string $profileName
Tags
access

public

Methods

__construct()

constructor

public __construct(mixed $params) : mixed
Parameters
$params : mixed

driver parameters, written in the ini file

Return values
mixed

decrement()

decrement a specific data value by $var

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

key used for storing data in the cache

$decvalue : mixed = 1

value used

Return values
bool

false if failure

delete()

delete a specific data in the cache

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

key used for storing data in the cache

Return values
bool

false if failure

flush()

clear all data in the cache.

public flush() : bool

If key_prefix is set, only keys with that prefix will be removed. Note that in that case, it can result in a huge performance issue. See key_prefix_flush_method to configure the best method for your app and your server.

Return values
bool

false if failure

garbage()

remove from the cache data of which TTL was expired element with TTL expired already removed => Nothing to do because redis has an internal garbage mechanism

public garbage() : bool
Return values
bool

get()

read a specific data in the cache.

public get(mixed $key) : mixed
Parameters
$key : mixed

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

Return values
mixed

$data array of data or false if failure

increment()

increment a specific data value by $var

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

key used for storing data in the cache

$incvalue : mixed = 1

value used

Return values
bool

false if failure

replace()

replace a specific data value by $var

public replace(string $key, mixed $var, int $ttl) : bool
Parameters
$key : string

key used for storing data in the cache

$var : mixed

data to replace

$ttl : int

data time expiration

Return values
bool

false if failure

set()

set a specific data in the cache.

public set(string $key, mixed $value, int $ttl) : bool
Parameters
$key : string

key used for storing data

$value : mixed
$ttl : int

data time expiration

Return values
bool

false if failure

esc()

protected esc(mixed $val) : mixed
Parameters
$val : mixed
Return values
mixed

getUsedKey()

protected getUsedKey(mixed $key) : mixed
Parameters
$key : mixed
Return values
mixed

unesc()

protected unesc(mixed $val) : mixed
Parameters
$val : mixed
Return values
mixed

Search results