\Horde_HashTable_Base

The Horde_HashTable class provides an API to interact with various hash table implementations.

Summary

Methods
Properties
Constants
__construct()
__set()
__get()
delete()
exists()
get()
set()
clear()
hkey()
offsetExists()
offsetGet()
offsetSet()
offsetUnset()
serialize()
unserialize()
$locking
$persistent
$prefix
No constants found
_init()
_delete()
_exists()
_get()
_getExists()
_set()
$_noexist
$_params
$_persistent
N/A
No private methods found
No private properties found
N/A

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

Methods

__construct()

__construct(array  $params = array()) 

Constructor.

Parameters

array $params

Configuration parameters:

  - logger: (Horde_Log_Logger) Logger object.
  - prefix: (string) Prefix to use for key storage.

Throws

\Horde_HashTable_Exception

__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

_init()

_init() 

Do initialization.

Throws

\Horde_HashTable_Exception

_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.