Zend Data Cache - PHP API

Table of Contents

PHP Functions

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

Description

boolean zend_shm_cache_store (string $key, mixed $value [ , int $ttl = 0 ])

Parameters
key
The data's key. Optional: prefix with a [namespace::]
value
Any PHP object that can be serialized
ttl
- 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. The default value is 0
Return Value

FALSE if cache storing fails, TRUE otherwise

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

Description

boolean zend_disk_cache_store (string $key, mixed $value [ , int $ttl = 0 ])

Parameters
key
The data key. Optional: prefix with a namespace
value
Any PHP object that can be serialized.
ttl
- 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. The default value is 0
Return Value

FALSE if cache storing fails, TRUE otherwise

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

Description

mixed zend_shm_cache_fetch (mixed $key)

Parameters
key
The data key or an array of data keys. Optional for key's name: prefix with a namespace
Return Value

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_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

Description

mixed zend_disk_cache_fetch (mixed $key)

Parameters
key
The data key or an array of data keys. Optional for key's name: prefix with a namespace
Return Value

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

Description

boolean zend_shm_cache_delete (mixed $key)

Parameters
key
The data key or an array of data keys. Optional for key's name: prefix with a namespace
Return Value

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

Description

boolean zend_disk_cache_delete (string $key)

Parameters
key
The data key or an array of data keys. Optional for key's name: prefix with a namespace
Return Value

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

Description

boolean zend_shm_cache_clear (string $namespace)

Parameters
namespace
The data key. Optional: prefix with a namespace
Return Value

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

Description

boolean zend_disk_cache_clear (string $namespace)

Parameters
namespace
The data key. Optional: prefix with a namespace
Return Value

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.