Documentation

CacheProvider implements Cache

AbstractYes

Base class for cache provider implementations.

Tags
since
2.2
author

Benjamin Eberlei kontakt@beberlei.de

author

Guilherme Blanco guilhermeblanco@hotmail.com

author

Jonathan Wage jonwage@gmail.com

author

Roman Borschel roman@code-factory.org

author

Fabio B. Silva fabio.bat.silva@gmail.com

subpackage

coremodule_cache

Table of Contents

Interfaces

Cache
Interface for cache drivers.

Constants

DOCTRINE_NAMESPACE_CACHEKEY  = 'DoctrineNamespaceCacheKey[%s]'

Properties

$namespace  : string
The namespace to prefix all cache ids with.
$namespaceVersion  : string
The namespace version.

Methods

contains()  : mixed
{@inheritdoc}
delete()  : mixed
{@inheritdoc}
deleteAll()  : bool
Deletes all cache entries.
fetch()  : mixed
{@inheritdoc}
flushAll()  : bool
Flushes all cache entries.
getNamespace()  : string
Retrieves the namespace that prefixes all cache ids.
getStats()  : mixed
{@inheritdoc}
save()  : mixed
{@inheritdoc}
setNamespace()  : void
Sets the namespace to prefix all cache ids with.
doContains()  : bool
Tests if an entry exists in the cache.
doDelete()  : bool
Deletes a cache entry.
doFetch()  : string|bool
Fetches an entry from the cache.
doFlush()  : bool
Flushes all cache entries.
doGetStats()  : array<string|int, mixed>|null
Retrieves cached information from the data store.
doSave()  : bool
Puts data into the cache.
getNamespaceCacheKey()  : string
Returns the namespace cache key.
getNamespacedId()  : string
Prefixes the passed id with the configured namespace value.
getNamespaceVersion()  : string
Returns the namespace version.

Constants

DOCTRINE_NAMESPACE_CACHEKEY

public mixed DOCTRINE_NAMESPACE_CACHEKEY = 'DoctrineNamespaceCacheKey[%s]'

Properties

$namespace

The namespace to prefix all cache ids with.

private string $namespace = ''

Methods

contains()

{@inheritdoc}

public contains(mixed $id) : mixed
Parameters
$id : mixed

deleteAll()

Deletes all cache entries.

public deleteAll() : bool
Return values
bool

TRUE if the cache entries were successfully deleted, FALSE otherwise.

flushAll()

Flushes all cache entries.

public flushAll() : bool
Return values
bool

TRUE if the cache entries were successfully flushed, FALSE otherwise.

getNamespace()

Retrieves the namespace that prefixes all cache ids.

public getNamespace() : string
Return values
string

save()

{@inheritdoc}

public save(mixed $id, mixed $data[, mixed $lifeTime = 0 ]) : mixed
Parameters
$id : mixed
$data : mixed
$lifeTime : mixed = 0

setNamespace()

Sets the namespace to prefix all cache ids with.

public setNamespace(string $namespace) : void
Parameters
$namespace : string

doContains()

Tests if an entry exists in the cache.

protected abstract doContains(string $id) : bool
Parameters
$id : string

The cache id of the entry to check for.

Return values
bool

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

doDelete()

Deletes a cache entry.

protected abstract doDelete(string $id) : bool
Parameters
$id : string

The cache id.

Return values
bool

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

doFetch()

Fetches an entry from the cache.

protected abstract doFetch(string $id) : string|bool
Parameters
$id : string

The id of the cache entry to fetch.

Return values
string|bool

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

doFlush()

Flushes all cache entries.

protected abstract doFlush() : bool
Return values
bool

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

doGetStats()

Retrieves cached information from the data store.

protected abstract doGetStats() : array<string|int, mixed>|null
Tags
since
2.2
Return values
array<string|int, mixed>|null

An associative array with server's statistics if available, NULL otherwise.

doSave()

Puts data into the cache.

protected abstract doSave(string $id, string $data[, int $lifeTime = 0 ]) : bool
Parameters
$id : string

The cache id.

$data : string

The cache entry/data.

$lifeTime : int = 0

The lifetime. If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime).

Return values
bool

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

getNamespaceCacheKey()

Returns the namespace cache key.

private getNamespaceCacheKey() : string
Return values
string

getNamespacedId()

Prefixes the passed id with the configured namespace value.

private getNamespacedId(string $id) : string
Parameters
$id : string

The id to namespace.

Return values
string

The namespaced id.

getNamespaceVersion()

Returns the namespace version.

private getNamespaceVersion() : string
Return values
string

        
On this page

Search results