FileCache
extends CacheProvider
in package
Base file cache driver.
Tags
Table of Contents
Constants
- DOCTRINE_NAMESPACE_CACHEKEY = 'DoctrineNamespaceCacheKey[%s]'
Properties
- $directory : string
- The cache directory.
- $extension : string|null
- The cache file extension.
- $namespace : string
- The namespace to prefix all cache ids with.
- $namespaceVersion : string
- The namespace version.
Methods
- __construct() : mixed
- Constructor.
- contains() : mixed
- {@inheritdoc}
- delete() : mixed
- {@inheritdoc}
- deleteAll() : bool
- Deletes all cache entries.
- fetch() : mixed
- {@inheritdoc}
- flushAll() : bool
- Flushes all cache entries.
- getDirectory() : string
- Gets the cache directory.
- getExtension() : string|null
- Gets the cache file extension.
- 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.
- getFilename() : string
- getIterator() : Iterator
- 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
$directory
The cache directory.
protected
string
$directory
$extension
The cache file extension.
protected
string|null
$extension
$namespace
The namespace to prefix all cache ids with.
private
string
$namespace
= ''
$namespaceVersion
The namespace version.
private
string
$namespaceVersion
Methods
__construct()
Constructor.
public
__construct(string $directory[, string|null $extension = null ]) : mixed
Parameters
- $directory : string
-
The cache directory.
- $extension : string|null = null
-
The cache file extension.
Tags
contains()
{@inheritdoc}
public
contains(mixed $id) : mixed
Parameters
- $id : mixed
delete()
{@inheritdoc}
public
delete(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.
fetch()
{@inheritdoc}
public
fetch(mixed $id) : mixed
Parameters
- $id : mixed
flushAll()
Flushes all cache entries.
public
flushAll() : bool
Return values
bool —TRUE if the cache entries were successfully flushed, FALSE otherwise.
getDirectory()
Gets the cache directory.
public
getDirectory() : string
Return values
stringgetExtension()
Gets the cache file extension.
public
getExtension() : string|null
Return values
string|nullgetNamespace()
Retrieves the namespace that prefixes all cache ids.
public
getNamespace() : string
Return values
stringgetStats()
{@inheritdoc}
public
getStats() : mixed
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
doDelete(mixed $id) : bool
Parameters
- $id : mixed
-
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
doFlush() : bool
Return values
bool —TRUE if the cache entry was successfully deleted, FALSE otherwise.
doGetStats()
Retrieves cached information from the data store.
protected
doGetStats() : array<string|int, mixed>|null
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.
getFilename()
protected
getFilename(string $id) : string
Parameters
- $id : string
Return values
stringgetIterator()
private
getIterator() : Iterator
Return values
IteratorgetNamespaceCacheKey()
Returns the namespace cache key.
private
getNamespaceCacheKey() : string
Return values
stringgetNamespacedId()
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