Zend_cache usage of the zf framework. This article mainly introduces the basic operations of Zend_Cache file caching. for a simple example, you can refer to the basic operations of Zend_Cache file caching. comments have been written in the code, this article mainly introduces the basic operations of Zend_Cache file cache, a simple example. For more information, see
The basic operations of Zend_Cache file cache are as follows: 60, 'automtic _ serialization' => true); // backend cache settings (cache storage path) $ Boptions = array ('cachedir' => 'cache '); // enable the Cache mode. (Core [Core], File [File], frontend Cache configuration information, and backend Cache configuration information) $ Cache = Zend_Cache: factory ('core ', 'file', $ Foptions, $ Boptions); // determines whether the cache exists. If yes, load the cache ('string' [cache name]) if ($ Result = $ Cache-> load ('cache _ two') {echo "the cache already exists!
"; Print_r ($ Result);} else {// if the cache does not exist, read the file and write the file content into the lake cache echo" the cache does not exist!
"; $ Filename = 'temp.txt '; $ Fopen = fopen ($ Filename, 'r'); $ Result = fread ($ Fopen, filesize ($ Filename )); fclose ($ Fopen); // save Cache mode load ($ Result [read resource], 'cache name') $ Cache-> save ($ Result, 'cache _ two'); print_r ($ Result) ;}?>
The basic operations of the Zend_Cache file cache, with comments written in the code ,...