DoctrineCacheAdapter
in package
implements
CacheInterface, Cache
Interfaces, Classes and Traits
- CacheInterface
- Represents a simple cache interface.
- Cache
- Interface for cache drivers.
Table of Contents
- $cache : Cache
- __construct() : mixed
- contains() : bool
- Tests if an entry exists in the cache.
- delete() : bool
- Deletes a cache entry.
- fetch() : mixed
- Fetches an entry from the cache.
- get() : mixed|null
- Get a cache item by key.
- getStats() : array<string|int, mixed>|null
- Retrieves cached information from the data store.
- remove() : mixed
- Remove a cache key.
- save() : bool
- Puts data into the cache.
- set() : mixed
- Set a cache key value.
Properties
$cache
private
Cache
$cache
Methods
__construct()
public
__construct(Cache $cache) : mixed
Parameters
- $cache : Cache
Return values
mixed —contains()
Tests if an entry exists in the cache.
public
contains(mixed $key) : bool
Parameters
- $key : mixed
Return values
bool —TRUE if a cache entry exists for the given cache id, FALSE otherwise.
delete()
Deletes a cache entry.
public
delete(mixed $key) : bool
Parameters
- $key : mixed
Return values
bool —TRUE if the cache entry was successfully deleted, FALSE otherwise. Deleting a non-existing entry is considered successful.
fetch()
Fetches an entry from the cache.
public
fetch(mixed $key) : mixed
Parameters
- $key : mixed
Return values
mixed —The cached data or FALSE, if no cache entry exists for the given id.
get()
Get a cache item by key.
public
get(mixed $key) : mixed|null
Parameters
- $key : mixed
-
Key to retrieve.
Return values
mixed|null —Returns the value or null if not found.
getStats()
Retrieves cached information from the data store.
public
getStats() : array<string|int, mixed>|null
The server's statistics array has the following values:
-
hits Number of keys that have been requested and found present.
-
misses Number of items that have been requested and not found.
-
uptime Time that the server is running.
-
memory_usage Memory used by this server to store items.
-
memory_available Memory allowed to use for storage.
Return values
array<string|int, mixed>|null —An associative array with server's statistics if available, NULL otherwise.
remove()
Remove a cache key.
public
remove(mixed $key) : mixed
Parameters
- $key : mixed
-
Key to remove.
Return values
mixed —save()
Puts data into the cache.
public
save(mixed $key, mixed $value, mixed $ttl) : bool
If a cache entry with the given id already exists, its data will be replaced.
Parameters
- $key : mixed
- $value : mixed
- $ttl : mixed
Return values
bool —TRUE if the entry was successfully stored in the cache, FALSE otherwise.
set()
Set a cache key value.
public
set(mixed $key, mixed $value, mixed $ttl) : mixed
Parameters
- $key : mixed
-
Key to set
- $value : mixed
-
Value to set.
- $ttl : mixed
-
Number of seconds the item is allowed to live. Set to 0 to allow an unlimited lifetime.