Created
January 19, 2012 12:55
-
-
Save eminetto/1639948 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//include do zend | |
$includePath = get_include_path(); | |
$includePath .= ':/Users/eminetto/Documents/Projects/library.git/'; | |
set_include_path($includePath); | |
require_once 'Zend/Loader/Autoloader.php'; | |
$autoloader = Zend_Loader_Autoloader::getInstance(); | |
$autoloader->setFallbackAutoloader(true); | |
$frontendOptions = array( | |
'lifetime' => 7200, // tempo de vida | |
'automatic_serialization' => true | |
); | |
$backendOptions = array('cache_dir' => '/tmp'); | |
// criando uma instancia do cache | |
$cache = Zend_Cache::factory('Core',//frontend | |
'File', //backend | |
$frontendOptions, | |
$backendOptions | |
); | |
if(!$result = $cache->load('cachePosts')) { | |
$result = 'aqui vai o processamento, como buscar os dados do banco'; | |
$cache->save($result, 'cachePosts'); | |
} | |
echo $result; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment