Zend Data Cache - PHP API
This topic lists the PHP API functions of the Zend Data Cache.
Zend Data Cache Functions
Function |
Description |
Stores a variable identified by key into the cache. If a namespace is provided, the key is stored under that namespace. Identical keys can exist under different namespaces. |
|
Stores a variable identified by key into the memory cache. If the given key is already cached, it won't be modified. If a namespace is provided, the key is stored under that namespace. Identical keys can exist under different namespaces. |
|
Stores a variable identified by a key into the cache. If a namespace is provided, the key is stored under that namespace. Identical keys can exist under different namespaces. |
|
Stores a variable identified by key into the disk cache. If the given key is already cached, it won't be modified. If a namespace is provided, the key is stored under that namespace. Identical keys can exist under different namespaces. |
|
Fetches data from the cache. The key can be prefixed with a namespace to indicate searching within the specified namespace only. If a namespace is not provided, the Data Cache searches for the key in the global namespace. |
|
Provide the user information about the memory data cache |
|
Fetches data from the cache. The key can be prefixed with a namespace to indicate searching within the specified namespace only. If a namespace is not provided, the Data Cache searches for the key in the global namespace. |
|
Finds and deletes an entry from the cache, using a key to identify it. The key can be prefixed with a namespace to indicate that the key can be deleted within that namespace only. If a namespace is not provided, the Data Cache searches for the key in the global namespace. |
|
Finds and deletes an entry from the cache, using a key to identify it. The key can be prefixed with a namespace to indicate that the key can be deleted within that namespace only. If a namespace is not provided, the Data Cache searches for the key in the global namespace. |
|
Deletes all entries from all namespaces in the cache, if a 'namespace' is provided, only the entries in that namespace are deleted. |
|
Deletes all entries from all namespaces in the cache, if a 'namespace' is provided, only the entries in that namespace are deleted. |
|
Check existence of shared memory cache entry by key |
|
Check existence of disk cache entry by key |
zend_shm_cache_store
Stores a variable identified by key into the cache. If a namespace is provided, the key is stored under that namespace. Identical keys can exist under different namespaces.
Available Since Version: 4.0
Parameter |
Type |
Required |
Description |
key |
string |
Yes |
The data's key. Optional: prefix with a [namespace::]. |
value |
mixed |
Yes |
Any PHP object that can be serialized. |
ttl |
int |
No |
Time to live, in seconds. The Data Cache keeps an object in the cache as long as the TTL is not expired. Once the TTL is expired, the object is removed from the cache. |
Return Value: boolean - FALSE if cache storing fails, TRUE otherwise.
zend_shm_cache_add
Stores a variable identified by key into the memory cache. If the given key is already cached, it won't be modified. If a namespace is provided, the key is stored under that namespace. Identical keys can exist under different namespaces.
Available Since Version: 8.0
Parameter |
Type |
Required |
Description |
key |
string |
Yes |
The data's key. Optional: prefix with a [namespace::]. |
value |
mixed |
Yes |
Any PHP object that can be serialized. |
ttl |
int |
No |
Time to live, in seconds. The Data Cache keeps an object in the cache as long as the TTL is not expired. Once the TTL is expired, the object is removed from the cache. |
Return Value: boolean - TRUE if cache storing done successfully, FALSE otherwise. If the given key is already cached, return FALSE.
zend_disk_cache_store
Stores a variable identified by a key into the cache. If a namespace is provided, the key is stored under that namespace. Identical keys can exist under different namespaces.
Available Since Version: 4.0
Parameter |
Type |
Required |
Description |
key |
string |
Yes |
The data key. Optional: prefix with a namespace. |
value |
mixed |
Yes |
Any PHP object that can be serialized. |
ttl |
int |
No |
Time to live, in seconds. The Data Cache keeps objects in the cache as long as the TTL is not expired. Once the TTL is expired, the object is removed from the cache. |
Return Value: boolean - FALSE if cache storing fails, TRUE otherwise.
zend_disk_cache_add
Stores a variable identified by key into the disk cache. If the given key is already cached, it won't be modified. If a namespace is provided, the key is stored under that namespace. Identical keys can exist under different namespaces.
Available Since Version: 8.0
Parameter |
Type |
Required |
Description |
key |
string |
Yes |
The data's key. Optional: prefix with a [namespace::]. |
value |
mixed |
Yes |
Any PHP object that can be serialized. |
ttl |
int |
No |
Time to live, in seconds. The Data Cache keeps an object in the cache as long as the TTL is not expired. Once the TTL is expired, the object is removed from the cache. |
Return Value: boolean - TRUE if cache storing done successfully, FALSE otherwise. If the given key is already cached, return FALSE.
zend_shm_cache_fetch
Fetches data from the cache. The key can be prefixed with a namespace to indicate searching within the specified namespace only. If a namespace is not provided, the Data Cache searches for the key in the global namespace.
Available Since Version: 4.0
Parameter |
Type |
Required |
Description |
key |
mixed |
Yes |
The data key or an array of data keys. Optional for key's name: prefix with a namespace. |
callback |
mixed |
No |
In case the requested entry does not exist in the cache, the callback is called to create a new cache entry. The API uses the callback's return value and stores it into the cache |
Return Value: mixed - FALSE if no data that matches the key is found, else it returns the stored data. If an array of keys is given, then an array, which its keys are the original keys and the values, are the corresponding stored data values.
zend_shm_cache_info
Provide the user information about the memory data cache
Available Since Version: 8.0
Return Value: mixed - FALSE if the Zend Data Cache is disabled else array , which contains information about the allocated and used memory per namespace in bytes.
zend_disk_cache_fetch
Fetches data from the cache. The key can be prefixed with a namespace to indicate searching within the specified namespace only. If a namespace is not provided, the Data Cache searches for the key in the global namespace.
Available Since Version: 4.0
Parameter |
Type |
Required |
Description |
key |
mixed |
Yes |
The data key or an array of data keys. Optional for key's name: prefix with a namespace. |
callback |
mixed |
No |
In case the requested entry does not exist in the cache, the callback is called to create a new cache entry. The API uses the callback's return value and stores it into the cache |
Return Value: mixed - FALSE if no data that matches the key is found, else it returns the stored data. If an array of keys is given, then an array, which its keys are the original keys and the values, are the corresponding stored data values
zend_shm_cache_delete
Finds and deletes an entry from the cache, using a key to identify it. The key can be prefixed with a namespace to indicate that the key can be deleted within that namespace only. If a namespace is not provided, the Data Cache searches for the key in the global namespace.
Available Since Version: 4.0
Parameter |
Type |
Required |
Description |
key |
mixed |
Yes |
The data key or an array of data keys. Optional for key's name: prefix with a namespace. |
clusterDelete |
boolean |
No |
When set to true (the default), the entry is deleted across the cluster |
Return Value: boolean - TRUE on success, FALSE on failure.
zend_disk_cache_delete
Finds and deletes an entry from the cache, using a key to identify it. The key can be prefixed with a namespace to indicate that the key can be deleted within that namespace only. If a namespace is not provided, the Data Cache searches for the key in the global namespace.
Available Since Version: 4.0
Parameter |
Type |
Required |
Description |
key |
string |
Yes |
The data key or an array of data keys. Optional for key's name: prefix with a namespace. |
clusterDelete |
boolean |
No |
When set to true (the default), the entry is deleted across the cluster |
Return Value: boolean - TRUE on success, FALSE on failure or when entry doesn't exist.
zend_shm_cache_clear
Deletes all entries from all namespaces in the cache, if a 'namespace' is provided, only the entries in that namespace are deleted.
Available Since Version: 4.0
Parameter |
Type |
Required |
Description |
namespace |
string |
Yes |
The data key. Optional: prefix with a namespace. |
clusterDelete |
boolean |
No |
When set to true (the default) the clear is taking place across the cluster |
Return Value: boolean - If the namespace does not exist or there are no items to clear, the function will return TRUE. The function will return FALSE only in case of error.
zend_disk_cache_clear
Deletes all entries from all namespaces in the cache, if a 'namespace' is provided, only the entries in that namespace are deleted.
Available Since Version: 4.0
Parameter |
Type |
Required |
Description |
namespace |
string |
Yes |
The data key. Optional: prefix with a namespace. |
clusterDelete |
boolean |
No |
When set to true (the default) the clear is taking place across the cluster |
Return Value: boolean - If the namespace does not exist, or there are no items to clear, the function will return TRUE. The function will return FALSE only in case of error.
zend_shm_cache_exist
Check existence of shared memory cache entry by key
Available Since Version: 6.3
Parameter |
Type |
Required |
Description |
key |
string |
Yes |
The data key |
Return Value: boolean - True is exists. False otherwise.
zend_disk_cache_exist
Check existence of disk cache entry by key
Available Since Version: 6.3
Parameter |
Type |
Required |
Description |
key |
string |
Yes |
The data key |
Return Value: boolean - True is exists. False otherwise.