6.0.0-git
2019-08-26

Diff for HashTable between 2 and 3

Notes on using HashTable!HashTable inside a horde app - Examples as typed in the horde php console

You need to configure a hash table first - there is a HashTable tab in the Horde config.
If you use Redis, you need the nrk channel Predis package first.

++ RetrieveRetrieving a HashTable!HashTable Instance

<code type="php">
$hashtable = $GLOBALS['injector']->getInstance('Horde_HashTable');
</code>

++ Setting a key and a scalar value

++ set a key and a scalar value
<code type="php">
$hashtable->set('key1', 'value1');
</code>

++ Setting a key and a structured value by serializing

++ set a key and a structured value by serializing<code type="php">
// Mind using Horde_Pack instead
$hashtable = $injector->getInstance('Horde_HashTable');

$data = array('foo', 'bar');
$packed = serialize($data);

$hashtable->set('packed', $packed);
$retrieved = $hashtable->get('packed');
print $retrieved;
print_r(unserialize($retrieved));
</code>

++ Checking if a key exists, retrieving

++ check if a key exists, retrieve ==
<code type="php">
if ($hashtable->exists('key1')) {
    $result = $hashtable->get('key1');
}

</code>