PHP Class Doctrine\Common\Cache\CacheProvider

Since: 2.2
Author: Benjamin Eberlei ([email protected])
Author: Guilherme Blanco ([email protected])
Author: Jonathan Wage ([email protected])
Author: Roman Borschel ([email protected])
Author: Fabio B. Silva ([email protected])
Inheritance: implements Doctrine\Common\Cache\Cache
显示文件 Open project: doctrine/cache Class Usage Examples

Public Methods

Method Description
contains ( $id )
delete ( $id )
deleteAll ( ) {@inheritDoc}
fetch ( $id )
fetchMultiple ( array $keys )
flushAll ( ) {@inheritDoc}
getNamespace ( ) : string Retrieves the namespace that prefixes all cache ids.
getStats ( )
save ( $id, $data, $lifeTime )
saveMultiple ( array $keysAndValues, $lifetime )
setNamespace ( string $namespace ) : void Sets the namespace to prefix all cache ids with.

Protected Methods

Method Description
doContains ( string $id ) : boolean Tests if an entry exists in the cache.
doDelete ( string $id ) : boolean Deletes a cache entry.
doFetch ( string $id ) : mixed | false Fetches an entry from the cache.
doFetchMultiple ( array $keys ) : array Default implementation of doFetchMultiple. Each driver that supports multi-get should owerwrite it.
doFlush ( ) : boolean Flushes all cache entries.
doGetStats ( ) : array | null Retrieves cached information from the data store.
doSave ( string $id, string $data, integer $lifeTime ) : boolean Puts data into the cache.
doSaveMultiple ( array $keysAndValues, integer $lifetime ) : boolean Default implementation of doSaveMultiple. Each driver that supports multi-put should override it.

Private Methods

Method Description
getNamespaceCacheKey ( ) : string Returns the namespace cache key.
getNamespaceVersion ( ) : integer Returns the namespace version.
getNamespacedId ( string $id ) : string Prefixes the passed id with the configured namespace value.

Method Details

contains() public method

public contains ( $id )

delete() public method

public delete ( $id )

deleteAll() public method

{@inheritDoc}
public deleteAll ( )

doContains() abstract protected method

Tests if an entry exists in the cache.
abstract protected doContains ( string $id ) : boolean
$id string The cache id of the entry to check for.
return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise.

doDelete() abstract protected method

Deletes a cache entry.
abstract protected doDelete ( string $id ) : boolean
$id string The cache id.
return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.

doFetch() abstract protected method

Fetches an entry from the cache.
abstract protected doFetch ( string $id ) : mixed | false
$id string The id of the cache entry to fetch.
return mixed | false The cached data or FALSE, if no cache entry exists for the given id.

doFetchMultiple() protected method

Default implementation of doFetchMultiple. Each driver that supports multi-get should owerwrite it.
protected doFetchMultiple ( array $keys ) : array
$keys array Array of keys to retrieve from cache
return array Array of values retrieved for the given keys.

doFlush() abstract protected method

Flushes all cache entries.
abstract protected doFlush ( ) : boolean
return boolean TRUE if the cache entries were successfully flushed, FALSE otherwise.

doGetStats() abstract protected method

Retrieves cached information from the data store.
Since: 2.2
abstract protected doGetStats ( ) : array | null
return array | null An associative array with server's statistics if available, NULL otherwise.

doSave() abstract protected method

Puts data into the cache.
abstract protected doSave ( string $id, string $data, integer $lifeTime ) : boolean
$id string The cache id.
$data string The cache entry/data.
$lifeTime integer The lifetime. If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime).
return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.

doSaveMultiple() protected method

Default implementation of doSaveMultiple. Each driver that supports multi-put should override it.
protected doSaveMultiple ( array $keysAndValues, integer $lifetime ) : boolean
$keysAndValues array Array of keys and values to save in cache
$lifetime integer The lifetime. If != 0, sets a specific lifetime for these cache entries (0 => infinite lifeTime).
return boolean TRUE if the operation was successful, FALSE if it wasn't.

fetch() public method

public fetch ( $id )

fetchMultiple() public method

public fetchMultiple ( array $keys )
$keys array

flushAll() public method

{@inheritDoc}
public flushAll ( )

getNamespace() public method

Retrieves the namespace that prefixes all cache ids.
public getNamespace ( ) : string
return string

getStats() public method

public getStats ( )

save() public method

public save ( $id, $data, $lifeTime )

saveMultiple() public method

public saveMultiple ( array $keysAndValues, $lifetime )
$keysAndValues array

setNamespace() public method

Sets the namespace to prefix all cache ids with.
public setNamespace ( string $namespace ) : void
$namespace string
return void