\Horde_Imap_Client_Cache_Backend_Cache

A Horde_Cache implementation for caching IMAP/POP data.

Requires the Horde_Cache package.

Summary

Methods
Properties
Constants
__construct()
setParams()
get()
getCachedUids()
set()
getMetaData()
setMetaData()
deleteMsgs()
deleteMailbox()
clear()
serialize()
unserialize()
save()
No public properties found
VERSION
_initOb()
_getCid()
_deleteMailbox()
_loadUids()
_loadSlice()
_loadSliceMap()
_toUpdate()
$_params
$_cache
$_data
$_loaded
$_slicemap
$_update
N/A
No private methods found
No private properties found
N/A

Constants

VERSION

VERSION

Cache structure version.

Properties

$_params

$_params : array

Configuration paramters.

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

Type

array

$_cache

$_cache : \Horde_Cache

The cache object.

Type

\Horde_Cache

$_data

$_data : array

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

Type

array

$_loaded

$_loaded : array

The list of cache slices loaded.

Type

array

$_slicemap

$_slicemap : array

The mapping of UIDs to slices.

Type

array

$_update

$_update : array

The list of items to update: - add: (array) List of IDs that were added.

  • slice: (array) List of slices that were modified.
    • slicemap: (boolean) Was slicemap info changed?

Type

array

Methods

__construct()

__construct(array  $params = array()) 

Constructor.

Parameters

array $params

Configuration parameters:

  - REQUIRED Parameters:
    - cacheob: (Horde_Cache) The cache object to use.

  - Optional Parameters:
    - lifetime: (integer) The lifetime of the cache data (in seconds).
                DEFAULT: 1 week (604800 seconds)
    - slicesize: (integer) The slicesize to use.
                 DEFAULT: 50

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.

_getCid()

_getCid(string  $mailbox, string  $slice) : string

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

Parameters

string $mailbox

The mailbox to cache.

string $slice

The cache slice.

Returns

string —

The cache ID.

_deleteMailbox()

_deleteMailbox(string  $mbox) 

Delete a mailbox from the cache.

Parameters

string $mbox

The mailbox to delete.

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

_loadSlice()

_loadSlice(string  $mailbox, integer  $slice) 

Load UIDs from a cache slice.

Parameters

string $mailbox

The mailbox to load.

integer $slice

The slice to load.

_loadSliceMap()

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

Load the slicemap for a given mailbox. The slicemap contains the uidvalidity information, the UIDs->slice lookup table, and any metadata that needs to be saved for the mailbox.

Parameters

string $mailbox

The mailbox.

integer $uidvalid

The IMAP uidvalidity value of the mailbox.

_toUpdate()

_toUpdate(string  $mailbox, string  $type, mixed  $data) 

Add update entry for a mailbox.

Parameters

string $mailbox

The mailbox.

string $type

'add', 'slice', or 'slicemap'.

mixed $data

The data to update.