Skip to content

Instantly share code, notes, and snippets.

@phalcon
Created December 17, 2012 22:00
Show Gist options
  • Save phalcon/4322715 to your computer and use it in GitHub Desktop.
Save phalcon/4322715 to your computer and use it in GitHub Desktop.
<?php
//With the default lifetime
$sidebar = $this->viewCache->start("sidebar");
if ($sidebar === null) {
echo '<!-- some sidebar code here -->';
$this->viewCache->save();
} else {
echo $sidebar;
}
//Setting a lifetime
$sidebar = $this->viewCache->start("sidebar");
if ($sidebar === null) {
echo '<!-- some sidebar code here -->';
$this->viewCache->save("sidebar", null, 3600);
} else {
echo $sidebar;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment