This example describes the ZendFramework Cache usage. For your reference, see phprequireZendLoader. php; Zend_Loader: loadClass (Zend_Cache); Zend_Loader: loadClass (Zend_Config); Zend_Loader: loadClass (Zend_Registry); $ confignewZend _
This example describes the Zend Framework Cache usage. For your reference, see phprequire 'zend/Loader. php '; Zend_Loader: loadClass ('zend _ cache'); Zend_Loader: loadClass ('zend _ config'); Zend_Loader: loadClass ('zend _ Registry '); $ config = new Zend _
This example describes the Zend Framework Cache usage. We will share this with you for your reference. The details are as follows:
<? Phprequire 'zend/Loader. php '; Zend_Loader: loadClass ('zend _ cache'); Zend_Loader: loadClass ('zend _ config'); Zend_Loader: loadClass ('zend _ Registry '); $ config = new Zend_Config_Ini ('configsecr/config. ini '); define ('cache _ dir', FDROOT. '/'. 'tmp/');/* config. ini: [cache] cache. needcache = 1cache. frontend. name = Corecache. frontend. lifetime = 7200cache. frontend. automatic_serialization = 1cache. backend. name = File * // * option reference Manual * // * Create a cache object */$ frontendOptions = $ config-> cache-> frontend-> toArray (); $ backendOptions = $ config-> cache-> backend-> toArray (); $ frontendName = $ frontendOptions ['name']; unset ($ frontendOptions ['name']); $ backendName = $ backendOptions ['name']; unset ($ backendOptions ['name']); if (empty ($ backendOptions ['cache _ dir']) {$ backendOptions ['cache _ dir'] = CACHE_DIR;} $ _ cache = Zend_Cache: factory ($ fro NtendName, $ backendName, $ frontendOptions, $ backendOptions); Zend_Registry: set ('cache', $ _ cache ); /* use cache */$ viewRenderer =$ _ cache-> load ('viewrenderer'); // try to load the variable if (! $ ViewRenderer instanceof Something) // loading failed {$ viewRenderer = new Something ();/* some other work */$ _ cache-> save ($ viewRenderer, 'viewrenerer'); // Save the variable to the memory change}/* this is only an application that can easily cache the entire page or store the cache in the database or memory. */?>