Jelix 1.8.8

memcacheKVDriver extends jKVDriver
in package
implements jIKVttl

Tags

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 = \false

..

Tags

$_connection

Name of the driver.

protected object|resource $_connection
Tags

$_profile

Profile for the connection in the kvdb INIfile.

protected array<string|int, mixed> $_profile
Tags

$_profileName

name of the profile.

protected string $_profileName
Tags

$_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()
Tags

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>
Tags
Return values
mixed

__destruct()

Class destructor.

public __destruct() : mixed
Tags
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

Tags
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
Tags
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

Tags
Return values
bool

false if failure

flush()

Flush the KVDb. Deletes all keys.

public flush() : bool
Tags
Return values
bool

true if it is a success

garbage()

delete all keys which are not any more valid.

public garbage() : bool
Tags
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

Tags
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
Tags
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
Tags
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

Tags
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
Tags
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
Tags
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

data to store

$ttl : int

data time expiration

Tags
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
Tags
Return values
mixed

isResource()

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

Search results