Skip to content

Instantly share code, notes, and snippets.

@eminetto
Created May 23, 2011 19:39
Show Gist options
  • Save eminetto/987404 to your computer and use it in GitHub Desktop.
Save eminetto/987404 to your computer and use it in GitHub Desktop.
$cache = Zend_Registry::get('cache');
//busca os posts
$posts = new Posts(); //cria um novo objeto Posts
//verifica se já está no cache o resultado
if(!$result = $cache->load('cachePosts')) {
//não existe no cache, processar e salvar
$result = $posts->fetchAll();//pega todos os posts
$cache->save($result, 'cachePosts');
}
$this->view->data = $result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment