Skip Navigation LinksHome > Categories > Code from a Category

Memcache and Zend: You "dropsĀ» Memcache?



User Name: serfcompany
Name: Serf
Contact Me: www.datawebcoder.com
Home Page: www.datawebcoder.com
php,mysql,javascript,html,css. Preferable working with Zend Framework. Good know javascript. I worked with various, javascript frameworks such as(jquery, YUI3, extjs, sencha touch). [More]
Viewed Times: 2806
Add Date: 06/22/2012
This small article on the problems of using Memcached and the Zend Framework.

When developing Web applications based on the above-mentioned binder is always a problem arose, I decided to elegant and compact way. It is a failure in Memcached and how to catch.


It happens that the Memcached daemon stops working and then use the usual adapters Zend_Cache_Backend your site will be unusable. But how to catch this situation? After all, when it occurs is not evident Exception connection or something like that, just a regular Warning.


I really wanted to address this issue in the use of caching files as a backup method of reducing the load on the server, as well as support the operation of the site.


To do this, I came up with the following solution:


1.after creating the object Zend_Cache check the possibility of saving some of the information in the cache;


2.If we were not able to do this, then we create another instance of Zend_Cache, which only works with files;


3.only if we return our object Zend_Cache;


Of course I will give a small piece of code for a better understanding of the above:



Basically, that's all. Now you all will run smoothly, but if you do not forget to check write permissions to the cache folder for the files, of course :)


Post a Comment

Name: (Optional)
Email: (Optional, you can get an email if somebody replys your comments)*
Email me if somebody respons my comment below:
Details**:
Enter Text
as Below:
(case insensitive, if hard to read, click the "get a new one" button)
 
    
* Your email address will not be shared with any third parties for any reason.
** Maximum 1000 charactors.