Object constructor.
rcube_cache
__construct
(string $type, int $userid, [string $prefix = ''], [int $ttl = 0], [bool $packed = true])
-
string
$type: Engine type ('db' or 'memcache' or 'apc')
-
int
$userid: User identifier
-
string
$prefix: Key name prefix
-
int
$ttl: Expiration time of memcache/apc items in seconds (max.2592000)
-
bool
$packed: Enables/disabled data serialization. It's possible to disable data serialization if you're sure stored data will be always a safe string
Writes the cache back to the DB.
void
close
()
Remove cache records older than ttl
void
expunge
()
Returns cached value.
mixed
get
(string $key)
-
string
$key: Cache key name
Returns cached value without storing it in internal memory.
mixed
read
(string $key)
-
string
$key: Cache key name
Clears the cache.
void
remove
([string $key = null], [boolean $prefix_mode = false])
-
string
$key: Cache key name or pattern
-
boolean
$prefix_mode: Enable it to clear all keys starting with prefix specified in $key
Sets (add/update) value in cache.
void
set
(string $key, mixed $data)
-
string
$key: Cache key name
-
mixed
$data: Cache data
Sets (add/update) value in cache and immediately saves it in the backend, no internal memory will be used.
void
write
(string $key, mixed $data, boolean 2)
-
string
$key: Cache key name
-
mixed
$data: Cache data
-
boolean
2: True on success, False on failure