class XcacheCache extends AbstractCache (View source)

Xcache cache driver.

Methods

void
setNamespace(string $namespace)

Set the namespace to prefix all cache ids with.

string
fetch(string $id)

Fetches an entry from the cache.

boolean
contains(string $id)

Test if an entry exists in the cache.

boolean
save(string $id, string $data, int $lifeTime = 0)

Puts data into the cache.

boolean
delete(string $id)

Deletes a cache entry.

array
deleteAll()

Delete all cache entries.

array
deleteByRegex(string $regex)

Delete cache entries where the id matches a PHP regular expressions

array
deleteByPrefix(string $prefix)

Delete cache entries where the id has the passed prefix

array
deleteBySuffix(string $suffix)

Delete cache entries where the id has the passed suffix

string
_doFetch(string $id)

Fetches an entry from the cache.

boolean
_doContains(string $id)

Test if an entry exists in the cache.

boolean
_doSave(string $id, string $data, int $lifeTime = 0)

Puts data into the cache.

boolean
_doDelete(string $id)

Deletes a cache entry.

array
getIds()

Get an array of all the cache ids stored

void
_checkAuth()

Checks that xcache.admin.enable_auth is Off

Details

void setNamespace(string $namespace)

Set the namespace to prefix all cache ids with.

Parameters

string $namespace

Return Value

void

string fetch(string $id)

Fetches an entry from the cache.

Parameters

string $id cache id The id of the cache entry to fetch.

Return Value

string The cached data or FALSE, if no cache entry exists for the given id.

boolean contains(string $id)

Test if an entry exists in the cache.

Parameters

string $id cache id The cache id of the entry to check for.

Return Value

boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise.

boolean save(string $id, string $data, int $lifeTime = 0)

Puts data into the cache.

Parameters

string $id The cache id.
string $data The cache entry/data.
int $lifeTime The lifetime. If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime).

Return Value

boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.

boolean delete(string $id)

Deletes a cache entry.

Parameters

string $id cache id

Return Value

boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.

array deleteAll()

Delete all cache entries.

Return Value

array $deleted Array of the deleted cache ids

array deleteByRegex(string $regex)

Delete cache entries where the id matches a PHP regular expressions

Parameters

string $regex

Return Value

array $deleted Array of the deleted cache ids

array deleteByPrefix(string $prefix)

Delete cache entries where the id has the passed prefix

Parameters

string $prefix

Return Value

array $deleted Array of the deleted cache ids

array deleteBySuffix(string $suffix)

Delete cache entries where the id has the passed suffix

Parameters

string $suffix

Return Value

array $deleted Array of the deleted cache ids

protected string _doFetch(string $id)

Fetches an entry from the cache.

Parameters

string $id cache id The id of the cache entry to fetch.

Return Value

string The cached data or FALSE, if no cache entry exists for the given id.

protected boolean _doContains(string $id)

Test if an entry exists in the cache.

Parameters

string $id cache id The cache id of the entry to check for.

Return Value

boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise.

protected boolean _doSave(string $id, string $data, int $lifeTime = 0)

Puts data into the cache.

Parameters

string $id The cache id.
string $data The cache entry/data.
int $lifeTime The lifetime. If != false, sets a specific lifetime for this cache entry (null => infinite lifeTime).

Return Value

boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.

protected boolean _doDelete(string $id)

Deletes a cache entry.

Parameters

string $id cache id

Return Value

boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.

array getIds()

Get an array of all the cache ids stored

Return Value

array $ids

protected void _checkAuth()

Checks that xcache.admin.enable_auth is Off

Return Value

void

Exceptions

BadMethodCallException When xcache.admin.enable_auth is On