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? Phprequire_once ("Zend/Loader. php "); // load Zend cache class (Zend_Cache) Zend_Loader: loadClass (" Zend_Cache "); // front-end cache settings (lifecycle, serialization or not) $ Foptions = array ('lifetime' => 60, 'automtic _ serialization' => true); // backend cache settings (cache storage path) $ Boptions = array ('cachedir' => 'cache'); // enable the cache mode (Core [Core], File [File], front-end cache configuration information, backend Cache configuration information) $ Cache = Zend_Cache: factory ('core', 'file', $ Foptions, $ Boptions); // determines whether the Cache exists, if yes, load the cache load ('string' [cache name]) if ($ Res Ult = $ Cache-> load ('cache _ two') {echo "the cache already exists! <Br> "; 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! <Br> "; $ 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) ;}?>