Ask Zend_Cache how to deal with the problem of recently Studying PHP Cache database data. zend & nbsp; framework has been used for a long time, which contains the Zend_Cache Cache class and can be used directly. now it is a bit of a problem. A user table needs to be cached. the main code is as follows: $ memcacheZend_Registry: get (memcache); & nbsp; if you want to know how to handle Zend_Cache
Recently I have been studying the issue of PHP Cache database data. I have been using zend framework, which contains the Zend_Cache cache class and can be used directly. now it is a problem.
A user table needs to be cached:
The main code is as follows:
$ Memcache = Zend_Registry: get ('memcache ');
If (! $ Admindata = $ memcache-> load ('data ')){
$ M_Admin = new Model_Admin ();
$ Admindata = $ m_Admin-> GetAllAdmin ();
$ Memcache-> save ($ admindata, 'data ');
}
A cached content marked as 'data' is cached above.
The difficulty is that it is better to update the cache. the number of users of this table is quite large, and some attributes are also in this user table. Therefore, the entire table is quite large. It is hard to say that one of my users has changed some information, so I will clear the entire cache and save it again? Or am I Updating the user information separately? (If so, what should I do ?)? Or what other solutions are available? could you please give me some guidance? thank you.
Cache zend database
------ Solution --------------------
The cache design is much more detailed, depending on your data size and update frequency.
If the cache is too thick, it will easily lead to faster updates.