\documentclass{article}
\usepackage{ulem}
\pagestyle{headings}
\begin{document}
Notes on using 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\footnote{http://example.com/index.php?page=HashTable} tab in the Horde config.\newline
If you use Redis, you need the nrk channel Predis package first.

\section{ Retrieving a HashTable Instance}
\begin{verbatim}

$hashtable = $GLOBALS['injector']->getInstance('Horde_HashTable');
\end{verbatim}

\section{ Setting a key and a scalar value}
\begin{verbatim}

$hashtable->set('key1', 'value1');
\end{verbatim}

\section{ Setting a key and a structured value by serializing}
\begin{verbatim}

// 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));
\end{verbatim}

\section{ Checking if a key exists, retrieving}
\begin{verbatim}

if ($hashtable->exists('key1')) {
    $result = $hashtable->get('key1');
}
\end{verbatim}

\end{document}
