\Horde_Imap_Client_Cache_Backend_Db

A SQL database implementation for caching IMAP/POP data.

Requires the Horde_Db package.

Summary

Methods
Properties
Constants
__construct()
setParams()
get()
getCachedUids()
set()
getMetaData()
setMetaData()
deleteMsgs()
deleteMailbox()
clear()
serialize()
unserialize()
No public properties found
BASE_TABLE
MD_TABLE
MSG_TABLE
_initOb()
_baseSql()
_getUid()
_createUid()
$_params
$_db
N/A
No private methods found
No private properties found
N/A

Constants

BASE_TABLE

BASE_TABLE

SQL table names.

MD_TABLE

MD_TABLE

MSG_TABLE

MSG_TABLE

Properties

$_params

$_params : array

Configuration paramters.

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

Type

array

$_db

$_db : \Horde_Db_Adapter

Handle for the database connection.

Type

\Horde_Db_Adapter

Methods

__construct()

__construct(array  $params = array()) 

Constructor.

Parameters

array $params

Configuration parameters:

  - REQUIRED Parameters:
    - db: (Horde_Db_Adapter) DB object.

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

_initOb()

_initOb() 

Initialization tasks.

_baseSql()

_baseSql(string  $mailbox, string  $join = null) : array

Prepare the base SQL query.

Parameters

string $mailbox

The mailbox.

string $join

The table to join with the base table.

Returns

array —

SQL query and bound parameters.

_getUid()

_getUid(string  $mailbox) : string

Parameters

string $mailbox

Returns

string —

UID from base table.

_createUid()

_createUid(string  $mailbox) : string

Parameters

string $mailbox

Returns

string —

UID from base table.