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

The following two tabs change content below.

Chandra Shekhar

GCP Architect
Chandra Shekhar Pandey is Google certified Cloud engineer, I am Magento2 Trained developer. Having huge experience in designing cloud solution. I have around 12 years of experience with world enterprise IT companies and fortune 500 clients. During my architecture design I am always caring about high availability, fast performance and resilient system. From the programmer background I have huge experience in LAMP stack as well. Throughout my carrier I have worked on Retail, E-Learning, Video Conferencing and social media domain. The motive of creating cutehits was just to share the knowledge/solutions I get to know during my day to day life so that if possible I can help someone for same problems/solutions. CuteHits.com is a really a very effort for sharing knowledge to rest of the world. For any query/suggestion about same you can contact me on below details:- Email: shekharmca2005 at gmail.com Phone: +91-9560201363

Latest posts by Chandra Shekhar (see all)

You may also like...