Introduction and Example of Zend Data Cache
As we have already explained the Zend Data Cache in Cache Introduction.
Zend data comes in action when it is imprectical or impossible to cache entire page output. For example if your section of data are more dynamic in nature like you are trying to cache your payment form where you have your credit card numbers, customer’s address and production info and so on in that case its not a better idea to cache output of full page instead of that Zend Data cache can be one good option here.
Following are the functionalities that can be achieved using data cache
*. Storing variables to the cache
*. Fetching variables to the cache
*. Deleting variables from the cache
*. Clearing the cache
*. Disk/Memory (SHM) storage
*. Caching using namespaces
*. Cache folder depth configuration
There are two functions that are used to achieve Zend data cache. These functions are
i) zend_shm_cache_store() : This function is used to store data into shared memory cache.
ii) zend_shm_cache_fetch() : This function is used to fetch data from shared memory.
iii) zend_disk_cache_store: To store cache in disk
iv) zend_disk_cache_fetch: To fetch cache from disk
Here one thing is notable that Zend offers two types of storage modules.
a) The Shared Modules (“shm”)
b) Disk Modules
if (zend_disk_cache_store("test1", 1) === false){ echo "Error in storing data"; exit(); }
if (zend_disk_cache_fetch("test1") === false){ echo "Error in fetching data"; exit(); }
Hope you have enjoyed..
Chandra Shekhar
Latest posts by Chandra Shekhar (see all)
- Best practices for micro service design - January 23, 2022
- Spring Boot - January 23, 2022
- Java - January 23, 2022
Recent Comments