\Horde_Imap_Client_Cache_Backend_Hashtable

A Horde_HashTable implementation for caching IMAP/POP data.

Requires the Horde_HashTable and Horde_Pack packages.

Summary

Methods
Properties
Constants
__construct()
setParams()
get()
getCachedUids()
set()
getMetaData()
setMetaData()
deleteMsgs()
deleteMailbox()
clear()
serialize()
unserialize()
save()
No public properties found
CID_SEPARATOR
_initOb()
_loadMailbox()
_loadUids()
_getCid()
_getMsgCids()
$_params
$_data
$_hash
$_mbox
$_pack
$_update
N/A
No private methods found
No private properties found
N/A

Constants

CID_SEPARATOR

CID_SEPARATOR

Separator for CID between mailbox and UID.

Properties

$_params

$_params : array

Configuration paramters.

Values set by the base Cache object: hostspec, port, username

Type

array

$_data

$_data : array

The working data for the current pageload. All changes take place to this data.

Type

array

$_hash

$_hash : \Horde_HashTable

HashTable object.

Type

\Horde_HashTable

$_mbox

$_mbox : array

Mailbox level data.

Type

array

$_pack

$_pack : \Horde_Pack

Horde_Pack singleton object.

Type

\Horde_Pack

$_update

$_update : array

List of mailbox/UIDs to update.

Keys are mailboxes. Values are arrays with three possible keys:

  - d: UIDs to delete
  - m: Was metadata updated?
  - u: UIDs to update

Type

array

Methods

__construct()

__construct(array  $params = array()) 

Constructor.

Parameters

array $params

Configuration parameters:

  - REQUIRED parameters:
    - hashtable: (Horde_HashTable) A HashTable object.

  - Optional Parameters:
    - lifetime: (integer) The lifetime of the cache data (in seconds).
                DEFAULT: 604800 seconds (1 week) [@since 2.19.0]

setParams()

setParams(array  $params = array()) 

Add configuration parameters.

Parameters

array $params

Configuration parameters.

get()

get(string  $mailbox, array  $uids, array  $fields, integer  $uidvalid) : array

Get information from the cache for a set of UIDs.

Parameters

string $mailbox

An IMAP mailbox string.

array $uids

The list of message UIDs to retrieve information for.

array $fields

An array of fields to retrieve. If empty, returns all cached fields.

integer $uidvalid

The IMAP uidvalidity value of the mailbox.

Returns

array —

An array of arrays with the UID of the message as the key (if found) and the fields as values (will be undefined if not found).

getCachedUids()

getCachedUids(string  $mailbox, integer  $uidvalid) : array

Get the list of cached UIDs.

Parameters

string $mailbox

An IMAP mailbox string.

integer $uidvalid

The IMAP uidvalidity value of the mailbox.

Returns

array —

The (unsorted) list of cached UIDs.

set()

set(string  $mailbox, array  $data, integer  $uidvalid) 

Store data in cache.

Parameters

string $mailbox

An IMAP mailbox string.

array $data

The list of data to save. The keys are the UIDs, the values are an array of information to save.

integer $uidvalid

The IMAP uidvalidity value of the mailbox.

getMetaData()

getMetaData(string  $mailbox, integer  $uidvalid, array  $entries) : array

Get metadata information for a mailbox.

Parameters

string $mailbox

An IMAP mailbox string.

integer $uidvalid

The IMAP uidvalidity value of the mailbox.

array $entries

An array of entries to return. If empty, returns all metadata.

Returns

array —

The requested metadata. Requested entries that do not exist will be undefined. The following entries are defaults and always present:

  • uidvalid: (integer) The UIDVALIDITY of the mailbox.

setMetaData()

setMetaData(string  $mailbox, array  $data) 

Set metadata information for a mailbox.

Parameters

string $mailbox

An IMAP mailbox string.

array $data

The list of data to save. The keys are the metadata IDs, the values are the associated data. (If present, uidvalidity appears as the 'uidvalid' key in $data.)

deleteMsgs()

deleteMsgs(string  $mailbox, array  $uids) 

Delete messages in the cache.

Parameters

string $mailbox

An IMAP mailbox string.

array $uids

The list of message UIDs to delete.

deleteMailbox()

deleteMailbox(string  $mailbox) 

Delete a mailbox from the cache.

Parameters

string $mailbox

The mailbox to delete.

clear()

clear(integer  $lifetime) 

Clear the cache.

Parameters

integer $lifetime

Only delete entries older than this (in seconds). If null, deletes all entries.

serialize()

serialize() 

unserialize()

unserialize(  $data) 

Parameters

$data

save()

save() 

Updates the cache.

_initOb()

_initOb() 

Initialization tasks.

_loadMailbox()

_loadMailbox(string  $mailbox, integer  $uidvalid = null) 

Loads basic mailbox information.

Parameters

string $mailbox

The mailbox to load.

integer $uidvalid

The IMAP uidvalidity value of the mailbox.

_loadUids()

_loadUids(string  $mailbox, array  $uids, integer  $uidvalid = null) 

Load UIDs by regenerating from the cache.

Parameters

string $mailbox

The mailbox to load.

array $uids

The UIDs to load.

integer $uidvalid

The IMAP uidvalidity value of the mailbox.

_getCid()

_getCid(string  $mailbox) : string

Create the unique ID used to store the mailbox data in the cache.

Parameters

string $mailbox

The mailbox to cache.

Returns

string —

The cache ID.

_getMsgCids()

_getMsgCids(string  $mailbox, array  $ids) : array

Return a list of cache IDs for mailbox/UID pairs.

Parameters

string $mailbox

The mailbox to cache.

array $ids

The UID list.

Returns

array —

List of UIDs => cache IDs.