Skip to content

Instantly share code, notes, and snippets.

@eminetto
Created January 19, 2012 12:55
Show Gist options
  • Save eminetto/1639948 to your computer and use it in GitHub Desktop.
Save eminetto/1639948 to your computer and use it in GitHub Desktop.
<?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