DoctrineProvider
extends CacheProvider
in package
This class was copied from the Symfony Framework, see the original copyright notice above. The code is distributed subject to the license terms in https://github.com/symfony/symfony/blob/ff0cf61278982539c49e467db9ab13cbd342f76d/LICENSE
Table of Contents
Constants
- DOCTRINE_NAMESPACE_CACHEKEY = 'DoctrineNamespaceCacheKey[%s]'
Properties
- $namespace : string
- The namespace to prefix all cache ids with.
- $namespaceVersion : int|null
- The namespace version.
- $pool : CacheItemPoolInterface
Methods
- contains() : bool
- Tests if an entry exists in the cache.
- delete() : bool
- Deletes a cache entry.
- deleteAll() : bool
- Deletes all cache entries in the current cache namespace.
- deleteMultiple() : mixed
- {@inheritdoc}
- fetch() : mixed
- Fetches an entry from the cache.
- fetchMultiple() : mixed
- {@inheritdoc}
- flushAll() : bool
- Flushes all cache entries, globally.
- getNamespace() : string
- Retrieves the namespace that prefixes all cache ids.
- getStats() : array<string|int, mixed>|null
- Retrieves cached information from the data store.
- reset() : void
- save() : bool
- Puts data into the cache.
- saveMultiple() : mixed
- {@inheritdoc}
- setNamespace() : void
- Sets the namespace to prefix all cache ids with.
- wrap() : Cache
- doContains() : bool
- Tests if an entry exists in the cache.
- doDelete() : bool
- Deletes a cache entry.
- doDeleteMultiple() : bool
- Default implementation of doDeleteMultiple. Each driver that supports multi-delete should override it.
- doFetch() : mixed|false
- Fetches an entry from the cache.
- doFetchMultiple() : array<string|int, mixed>
- Default implementation of doFetchMultiple. Each driver that supports multi-get should owerwrite it.
- 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.
- doSaveMultiple() : bool
- Default implementation of doSaveMultiple. Each driver that supports multi-put should override it.
- __construct() : mixed
- getNamespaceCacheKey() : string
- Returns the namespace cache key.
- getNamespacedId() : string
- Prefixes the passed id with the configured namespace value.
- getNamespaceVersion() : int
- 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
= ''
$namespaceVersion
The namespace version.
private
int|null
$namespaceVersion
$pool
private
CacheItemPoolInterface
$pool
Methods
contains()
Tests if an entry exists in the cache.
public
contains(mixed $id) : bool
Parameters
- $id : mixed
-
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.
delete()
Deletes a cache entry.
public
delete(mixed $id) : bool
Parameters
- $id : mixed
-
The cache id.
Return values
bool —TRUE if the cache entry was successfully deleted, FALSE otherwise. Deleting a non-existing entry is considered successful.
deleteAll()
Deletes all cache entries in the current cache namespace.
public
deleteAll() : bool
Return values
bool —TRUE if the cache entries were successfully deleted, FALSE otherwise.
deleteMultiple()
{@inheritdoc}
public
deleteMultiple(array<string|int, mixed> $keys) : mixed
Parameters
- $keys : array<string|int, mixed>
fetch()
Fetches an entry from the cache.
public
fetch(mixed $id) : mixed
Parameters
- $id : mixed
-
The id of the cache entry to fetch.
Return values
mixed —The cached data or FALSE, if no cache entry exists for the given id.
fetchMultiple()
{@inheritdoc}
public
fetchMultiple(array<string|int, mixed> $keys) : mixed
Parameters
- $keys : array<string|int, mixed>
flushAll()
Flushes all cache entries, globally.
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
stringgetStats()
Retrieves cached information from the data store.
public
getStats() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —An associative array with server's statistics if available, NULL otherwise.
reset()
public
reset() : void
save()
Puts data into the cache.
public
save(mixed $id, mixed $data[, mixed $lifeTime = 0 ]) : bool
Parameters
- $id : mixed
-
The cache id.
- $data : mixed
-
The cache entry/data.
- $lifeTime : mixed = 0
-
The lifetime in number of seconds for this cache entry. If zero (the default), the entry never expires (although it may be deleted from the cache to make place for other entries).
Return values
bool —TRUE if the entry was successfully stored in the cache, FALSE otherwise.
saveMultiple()
{@inheritdoc}
public
saveMultiple(array<string|int, mixed> $keysAndValues[, mixed $lifetime = 0 ]) : mixed
Parameters
- $keysAndValues : array<string|int, mixed>
- $lifetime : mixed = 0
setNamespace()
Sets the namespace to prefix all cache ids with.
public
setNamespace(string $namespace) : void
Parameters
- $namespace : string
wrap()
public
static wrap(CacheItemPoolInterface $pool) : Cache
Parameters
- $pool : CacheItemPoolInterface
Return values
CachedoContains()
Tests if an entry exists in the cache.
protected
doContains(mixed $id) : bool
Parameters
- $id : mixed
-
The cache id of the entry to check for.
Return values
booldoDelete()
Deletes a cache entry.
protected
doDelete(mixed $id) : bool
Parameters
- $id : mixed
-
The cache id.
Return values
booldoDeleteMultiple()
Default implementation of doDeleteMultiple. Each driver that supports multi-delete should override it.
protected
doDeleteMultiple(array<string|int, string> $keys) : bool
Parameters
- $keys : array<string|int, string>
-
Array of keys to delete from cache
Return values
bool —TRUE if the operation was successful, FALSE if it wasn't
doFetch()
Fetches an entry from the cache.
protected
doFetch(mixed $id) : mixed|false
Parameters
- $id : mixed
-
The id of the cache entry to fetch.
Return values
mixed|false —The cached data or FALSE, if no cache entry exists for the given id.
doFetchMultiple()
Default implementation of doFetchMultiple. Each driver that supports multi-get should owerwrite it.
protected
doFetchMultiple(array<string|int, string> $keys) : array<string|int, mixed>
Parameters
- $keys : array<string|int, string>
-
Array of keys to retrieve from cache
Return values
array<string|int, mixed> —Array of values retrieved for the given keys.
doFlush()
Flushes all cache entries.
protected
doFlush() : bool
Return values
booldoGetStats()
Retrieves cached information from the data store.
protected
doGetStats() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nulldoSave()
Puts data into the cache.
protected
doSave(mixed $id, mixed $data[, mixed $lifeTime = 0 ]) : bool
Parameters
- $id : mixed
-
The cache id.
- $data : mixed
-
The cache entry/data.
- $lifeTime : mixed = 0
-
The lifetime. If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime).
Return values
booldoSaveMultiple()
Default implementation of doSaveMultiple. Each driver that supports multi-put should override it.
protected
doSaveMultiple(array<string|int, mixed> $keysAndValues[, int $lifetime = 0 ]) : bool
Parameters
- $keysAndValues : array<string|int, mixed>
-
Array of keys and values to save in cache
- $lifetime : int = 0
-
The lifetime. If != 0, sets a specific lifetime for these cache entries (0 => infinite lifeTime).
Return values
bool —TRUE if the operation was successful, FALSE if it wasn't.
__construct()
private
__construct(CacheItemPoolInterface $pool) : mixed
Parameters
- $pool : CacheItemPoolInterface
getNamespaceCacheKey()
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() : int