Constants

LOCK_SUFFIX

LOCK_SUFFIX

LOCK_TIMEOUT

LOCK_TIMEOUT

Properties

$locking

$locking : boolean

Does hash table provide locking? (@since 1.1.0)

Type

boolean

$persistent

$persistent : boolean

Does hash table provide persistent storage?

Type

boolean

$prefix

$prefix : string

Set the hash key prefix.

Type

string

$_noexist

$_noexist : array

A list of items known not to exist.

Type

array

$_params

$_params : array

Configuration parameters.

Type

array

$_persistent

$_persistent : boolean

Persistent storage provided by driver?

Type

boolean

$_locks

$_locks : array

Locked keys.

Type

array

$_predis

$_predis : \Predis\Client

Predis client object.

Type

\Predis\Client

Methods

__construct()

__construct(array  $params = array()) 

Constructor.

Parameters

array $params

Additional configuration parameters:

  - predis: (Predis\Client) [REQUIRED] Predis client object.

__set()

__set(  $name,   $val) 

Parameters

$name
$val

__get()

__get(  $name) 

Parameters

$name

delete()

delete(mixed  $keys) : boolean

Delete a key(s).

Parameters

mixed $keys

The key or an array of keys to delete.

Returns

boolean —

True on success.

exists()

exists(mixed  $keys) : mixed

Do the keys exists?

Parameters

mixed $keys

The key or an array of keys.

Returns

mixed —

A boolean/array of booleans indicating existence (return type is the type of $keys).

get()

get(mixed  $keys) : mixed

Get data associated with a key(s).

Parameters

mixed $keys

The key or an array of keys.

Returns

mixed —

The string/array on success (return type is the type of $keys); false value(s) on failure.

set()

set(string  $key, string  $val, array  $opts = array()) : boolean

Set the value of a key.

Parameters

string $key

The key.

string $val

The string to store.

array $opts

Additional options:

  - expire: (integer) Expiration time in seconds.
            DEFAULT: Doesn't expire.
  - replace: (boolean) Replace the value of key. If key doesn't exist,
             returns false.
             DEFAULT: false

Returns

boolean —

True on success, false on error.

clear()

clear() 

Clear all hash table entries.

hkey()

hkey(string  $key) : string

Add local prefix to beginning of key.

Parameters

string $key

Key name.

Returns

string —

Hash table key identifier.

offsetExists()

offsetExists(  $offset) 

Parameters

$offset

offsetGet()

offsetGet(  $offset) 

Parameters

$offset

offsetSet()

offsetSet(  $offset,   $value) 

Parameters

$offset
$value

offsetUnset()

offsetUnset(  $offset) 

Parameters

$offset

serialize()

serialize() 

unserialize()

unserialize(  $data) 

Parameters

$data

shutdown()

shutdown() 

Shutdown function.

lock()

lock(string  $key) 

Obtain lock on a key.

Parameters

string $key

The key to lock.

unlock()

unlock(string  $key) 

Release lock on a key.

Parameters

string $key

The key to lock.

_init()

_init() 

Do initialization.

_delete()

_delete(  $keys) : boolean

Delete keys.

Parameters

$keys

Returns

boolean —

True on success.

_exists()

_exists(array  $keys) : array

Get data associated with keys.

Parameters

array $keys

An array of keys.

Returns

array —

Existence check. Values are boolean true/false.

_get()

_get(array  $keys) : array

Get data associated with keys.

Parameters

array $keys

An array of keys.

Returns

array —

The retrieved keys. Non-existent keys should return false as the value.

_getExists()

_getExists(mixed  $keys, callable  $callback) : mixed

Does a get/exists action on a set of keys.

Parameters

mixed $keys

The key or an array of keys.

callable $callback

The internal callback action.

Returns

mixed —

The results.

_set()

_set(string  $key, string  $val, array  $opts) : boolean

Set the value of a key.

Parameters

string $key

The key.

string $val

The string to store.

array $opts

Additional options (see set()).

Returns

boolean —

True on success.