rcube_cache_shared

Interface class for accessing Roundcube shared cache

package

Framework

subpackage

Cache

author

Thomas Bruederli roundcube@gmail.com

author

Aleksander Machniak alec@alec.pl

Methods

Object constructor.

__construct(string $type, string $prefix = '', string $ttl, boolean $packed = true) 

Arguments

$type

string

Engine type ('db' or 'memcache' or 'apc')

$prefix

string

Key name prefix

$ttl

string

Expiration time of memcache/apc items

$packed

boolean

Enables/disabled data serialization. It's possible to disable data serialization if you're sure stored data will be always a safe string

Adds entry into memcache/apc DB.

add_record(string $key, mixed $data) 

Arguments

$key

string

Cache internal key name

$data

mixed

Serialized cache data

Creates cache key name (for memcache and apc)

ckey(string $key) : string

Arguments

$key

string

Cache key name

Response

string

Cache key

Writes the cache back to the DB.

close() 

Write memcache/apc debug info to the log

debug( $type,  $key,  $data = null,  $result = null) 

Arguments

$type

$key

$data

$result

Deletes entry from memcache/apc DB.

delete_record(string $key) 

Arguments

$key

string

Cache internal key name

Remove cache records older than ttl

expunge() 

Remove expired records of all caches

gc() 
static

Returns cached value.

get(string $key) : mixed

Arguments

$key

string

Cache key name

Response

mixed

Cached value

Creates index cache key name (for memcache and apc)

ikey() : string

Response

string

Cache key

Gets the index entry from memcache/apc DB.

load_index() 

Determine the maximum size for cache data to be written

max_packet_size() 

Returns cached value without storing it in internal memory.

read(string $key) : mixed

Arguments

$key

string

Cache key name

Response

mixed

Cached value

Reads cache entry.

read_record(string $key, boolean $nostore = false) : mixed

Arguments

$key

string

Cache key name

$nostore

boolean

Enable to skip in-memory store

Response

mixed

Cached value

Clears the cache.

remove(string $key = null, boolean $prefix_mode = false) 

Arguments

$key

string

Cache key name or pattern

$prefix_mode

boolean

Enable it to clear all keys starting with prefix specified in $key

Deletes the cache record(s).

remove_record(string $key = null, boolean $prefix_mode = false) 

Arguments

$key

string

Cache key name or pattern

$prefix_mode

boolean

Enable it to clear all keys starting with prefix specified in $key

Serializes data for storing

serialize( $data) 

Arguments

$data

Sets (add/update) value in cache.

set(string $key, mixed $data) 

Arguments

$key

string

Cache key name

$data

mixed

Cache data

Unserializes serialized data

unserialize( $data) 

Arguments

$data

Sets (add/update) value in cache and immediately saves it in the backend, no internal memory will be used.

write(string $key, mixed $data) 

Arguments

$key

string

Cache key name

$data

mixed

Cache data

Writes the index entry into memcache/apc DB.

write_index() 

Writes single cache record into DB.

write_record(string $key, mixed $data) 

Arguments

$key

string

Cache key name

$data

mixed

Serialized cache data

Properties

Instance of database handler

db : \rcube_db|\Memcache|boolean
var

Type(s)

\rcube_db|\Memcache|boolean

type

type : 

Type(s)

prefix

prefix : 

Type(s)

ttl

ttl : 

Type(s)

packed

packed : 

Type(s)

index

index : 

Type(s)

table

table : 

Type(s)

debug

debug : 

Type(s)

index_changed

index_changed : 

Type(s)

cache

cache : 

Type(s)

cache_changes

cache_changes : 

Type(s)

cache_sums

cache_sums : 

Type(s)

max_packet

max_packet : 

Type(s)