Jelix 1.7.18

memcacheKVDriver extends jKVDriver
in package
implements jIKVttl

Tags
subpackage

kvdb_plugin

author

Yannick Le Guédart

contributor

Laurent Jouanneau

copyright

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

see
http://www.jelix.org
see
http://fr2.php.net/manual/en/book.memcache.php
licence

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

Interfaces, Classes and Traits

jIKVttl
interface for KV driver which support 'time to live' on values useful to use the driver as a cache storage.

Table of Contents

$_compress  : bool
Should the data be compressed ? This feature is implemented sometimes in memcached drivers, and works sometimes.
$_connection  : object|resource
Name of the driver.
$_driverName  : string
Name of the driver.
$_profile  : array<string|int, mixed>
Profile for the connection in the kvdb INIfile.
$_profileName  : string
name of the profile.
$_servers  : array<string|int, object>
Array of StdClass objects that contains host/port attributes for the memcache servers. Used only during _connection.
__construct()  : mixed
Class constructor.
__destruct()  : mixed
Class destructor.
append()  : bool
append a string to an existing key value.
decrement()  : int
decrement a specific data value by $var.
delete()  : bool
Deletes a key from the KVdb.
flush()  : bool
Flush the KVDb. Deletes all keys.
garbage()  : bool
delete all keys which are not any more valid.
get()  : string
Gets one or several values;.
increment()  : int
increment a specific data value by $var.
insert()  : bool
Store a key/value. If the key already exist : error.
prepend()  : bool
prepend a string to an existing key value.
replace()  : bool
Store a key/value. The key should exists.
set()  : bool
Store a key/value.
setWithTtl()  : bool
set a specific data with a ttl.
_connect()  : Memcache
Connects to the memcache server.
_disconnect()  : mixed
Disconnect from the memcache server.
isResource()  : mixed

Properties

$_compress

Should the data be compressed ? This feature is implemented sometimes in memcached drivers, and works sometimes.

protected bool $_compress = alse

..

$_connection

Name of the driver.

protected object|resource $_connection

$_profile

Profile for the connection in the kvdb INIfile.

protected array<string|int, mixed> $_profile

$_servers

Array of StdClass objects that contains host/port attributes for the memcache servers. Used only during _connection.

private array<string|int, object> $_servers = array()

Methods

__construct()

Class constructor.

public __construct(array<string|int, mixed> $profile) : mixed

Initialise profile data and create the main object

Parameters
$profile : array<string|int, mixed>
Return values
mixed

__destruct()

Class destructor.

public __destruct() : mixed
Return values
mixed

append()

append a string to an existing key value.

public append(string $key, string $value) : bool
Parameters
$key : string

the key of the value to modify

$value : string

the value to append to the current key value

Return values
bool

false if failure

decrement()

decrement a specific data value by $var.

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

key used for storing data in the cache

$decvalue : mixed = 1
Return values
int

the result, or false if failure

delete()

Deletes a key from the KVdb.

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

the key

Return values
bool

false if failure

flush()

Flush the KVDb. Deletes all keys.

public flush() : bool
Return values
bool

true if it is a success

garbage()

delete all keys which are not any more valid.

public garbage() : bool
Return values
bool

false if failure

get()

Gets one or several values;.

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

a key or an array of keys

Return values
string

or null if the key doesn't exist

increment()

increment a specific data value by $var.

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

key used for storing data in the cache

$incvalue : mixed = 1
Return values
int

the result, or false if failure

insert()

Store a key/value. If the key already exist : error.

public insert(mixed $key, mixed $value) : bool
Parameters
$key : mixed

the key

$value : mixed
Return values
bool

false if failure

prepend()

prepend a string to an existing key value.

public prepend(string $key, string $value) : bool
Parameters
$key : string

the key of the value to modify

$value : string

the value to prepend to the current key value

Return values
bool

false if failure

replace()

Store a key/value. The key should exists.

public replace(mixed $key, mixed $value) : bool
Parameters
$key : mixed

the key

$value : mixed
Return values
bool

false if failure

set()

Store a key/value.

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

the key

$value : mixed
Return values
bool

false if failure, if the value is a resource...

setWithTtl()

set a specific data with a ttl.

public setWithTtl(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

_connect()

Connects to the memcache server.

protected _connect() : Memcache

The host list is in the host profile value, in the form of :

host=server1:port1;server2:port2;server3;port3;...

Tags
throws
jException
Return values
Memcache

object

_disconnect()

Disconnect from the memcache server.

protected _disconnect() : mixed
Return values
mixed

isResource()

protected isResource(mixed $value) : mixed
Parameters
$value : mixed
Return values
mixed

Search results