API Reference Guide > Zend Data Cache - PHP API

Zend Data Cache - PHP API

This topic lists the PHP API functions of the Zend Data Cache.

Zend Data Cache Functions

Function

Description

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.

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.

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.

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.

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.

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.

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.

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.

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

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

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.

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.

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.

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.

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.