Documentation

Horde_Imap_Client_Cache_Backend_Cache extends Horde_Imap_Client_Cache_Backend
in package

A Horde_Cache implementation for caching IMAP/POP data.

Requires the Horde_Cache package.

Tags
author

Michael Slusarz slusarz@horde.org

category

Horde

copyright

2005-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

VERSION  = 3
Cache structure version.
$_cache  : Horde_Cache
The cache object.
$_data  : array<string|int, mixed>
The working data for the current pageload. All changes take place to this data.
$_loaded  : array<string|int, mixed>
The list of cache slices loaded.
$_params  : array<string|int, mixed>
Configuration paramters.
$_slicemap  : array<string|int, mixed>
The mapping of UIDs to slices.
$_update  : array<string|int, mixed>
The list of items to update: - add: (array) List of IDs that were added.
__construct()  : mixed
Constructor.
__serialize()  : array<string|int, mixed>
__unserialize()  : mixed
clear()  : mixed
Clear the cache.
deleteMailbox()  : mixed
Delete a mailbox from the cache.
deleteMsgs()  : mixed
Delete messages in the cache.
get()  : array<string|int, mixed>
Get information from the cache for a set of UIDs.
getCachedUids()  : array<string|int, mixed>
Get the list of cached UIDs.
getMetaData()  : array<string|int, mixed>
Get metadata information for a mailbox.
save()  : mixed
Updates the cache.
serialize()  : mixed
set()  : mixed
Store data in cache.
setMetaData()  : mixed
Set metadata information for a mailbox.
setParams()  : mixed
Add configuration parameters.
unserialize()  : mixed
_deleteMailbox()  : mixed
Delete a mailbox from the cache.
_getCid()  : string
Create the unique ID used to store the data in the cache.
_initOb()  : mixed
Initialization tasks.
_loadSlice()  : mixed
Load UIDs from a cache slice.
_loadSliceMap()  : mixed
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.
_loadUids()  : mixed
Load UIDs by regenerating from the cache.
_toUpdate()  : mixed
Add update entry for a mailbox.

Constants

VERSION

Cache structure version.

public mixed VERSION = 3

Properties

$_cache

The cache object.

protected Horde_Cache $_cache

$_data

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

protected array<string|int, mixed> $_data = array()

$_loaded

The list of cache slices loaded.

protected array<string|int, mixed> $_loaded = array()

$_params

Configuration paramters.

protected array<string|int, mixed> $_params = array()

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

$_slicemap

The mapping of UIDs to slices.

protected array<string|int, mixed> $_slicemap = array()

$_update

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

protected array<string|int, mixed> $_update = array()
  • slice: (array) List of slices that were modified.
  • slicemap: (boolean) Was slicemap info changed?

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
$params : array<string|int, mixed> = array()

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
Return values
mixed

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__unserialize()

public __unserialize(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>
Return values
mixed

clear()

Clear the cache.

public clear(mixed $lifetime) : mixed
Parameters
$lifetime : mixed

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

Return values
mixed

deleteMailbox()

Delete a mailbox from the cache.

public deleteMailbox(mixed $mailbox) : mixed
Parameters
$mailbox : mixed

The mailbox to delete.

Return values
mixed

deleteMsgs()

Delete messages in the cache.

public deleteMsgs(mixed $mailbox, mixed $uids) : mixed
Parameters
$mailbox : mixed

An IMAP mailbox string.

$uids : mixed

The list of message UIDs to delete.

Return values
mixed

get()

Get information from the cache for a set of UIDs.

public get(mixed $mailbox, mixed $uids, mixed $fields, mixed $uidvalid) : array<string|int, mixed>
Parameters
$mailbox : mixed

An IMAP mailbox string.

$uids : mixed

The list of message UIDs to retrieve information for.

$fields : mixed

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

$uidvalid : mixed

The IMAP uidvalidity value of the mailbox.

Return values
array<string|int, mixed>

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()

Get the list of cached UIDs.

public getCachedUids(mixed $mailbox, mixed $uidvalid) : array<string|int, mixed>
Parameters
$mailbox : mixed

An IMAP mailbox string.

$uidvalid : mixed

The IMAP uidvalidity value of the mailbox.

Return values
array<string|int, mixed>

The (unsorted) list of cached UIDs.

getMetaData()

Get metadata information for a mailbox.

public getMetaData(mixed $mailbox, mixed $uidvalid, mixed $entries) : array<string|int, mixed>
Parameters
$mailbox : mixed

An IMAP mailbox string.

$uidvalid : mixed

The IMAP uidvalidity value of the mailbox.

$entries : mixed

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

Return values
array<string|int, mixed>

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.

save()

Updates the cache.

public save() : mixed
Return values
mixed

serialize()

public serialize() : mixed
Return values
mixed

set()

Store data in cache.

public set(mixed $mailbox, mixed $data, mixed $uidvalid) : mixed
Parameters
$mailbox : mixed

An IMAP mailbox string.

$data : mixed

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

$uidvalid : mixed

The IMAP uidvalidity value of the mailbox.

Return values
mixed

setMetaData()

Set metadata information for a mailbox.

public setMetaData(mixed $mailbox, mixed $data) : mixed
Parameters
$mailbox : mixed

An IMAP mailbox string.

$data : mixed

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

Return values
mixed

setParams()

Add configuration parameters.

public setParams([array<string|int, mixed> $params = array() ]) : mixed
Parameters
$params : array<string|int, mixed> = array()

Configuration parameters.

Return values
mixed

unserialize()

public unserialize(mixed $data) : mixed
Parameters
$data : mixed
Return values
mixed

_deleteMailbox()

Delete a mailbox from the cache.

protected _deleteMailbox(string $mbox) : mixed
Parameters
$mbox : string

The mailbox to delete.

Return values
mixed

_getCid()

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

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

The mailbox to cache.

$slice : string

The cache slice.

Return values
string

The cache ID.

_initOb()

Initialization tasks.

protected _initOb() : mixed
Return values
mixed

_loadSlice()

Load UIDs from a cache slice.

protected _loadSlice(string $mailbox, int $slice) : mixed
Parameters
$mailbox : string

The mailbox to load.

$slice : int

The slice to load.

Return values
mixed

_loadSliceMap()

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.

protected _loadSliceMap(string $mailbox[, int $uidvalid = null ]) : mixed
Parameters
$mailbox : string

The mailbox.

$uidvalid : int = null

The IMAP uidvalidity value of the mailbox.

Return values
mixed

_loadUids()

Load UIDs by regenerating from the cache.

protected _loadUids(string $mailbox, array<string|int, mixed> $uids[, int $uidvalid = null ]) : mixed
Parameters
$mailbox : string

The mailbox to load.

$uids : array<string|int, mixed>

The UIDs to load.

$uidvalid : int = null

The IMAP uidvalidity value of the mailbox.

Return values
mixed

_toUpdate()

Add update entry for a mailbox.

protected _toUpdate(string $mailbox, string $type, mixed $data) : mixed
Parameters
$mailbox : string

The mailbox.

$type : string

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

$data : mixed

The data to update.

Return values
mixed

Search results