Moderators: jmacgreg, michael, jheckman, barbarah, btbell, bdgregg, asmecher
import('cache.CacheManager');
$cacheManager =& CacheManager::getManager();
$cache = $cacheManager->getFileCache('page', /* this is the name of the group of items you want to cache - existing examples are 'journalSettings' and 'country'*/
$cacheId . "-" . Locale::getLocale() , /* this is specific to this particular instance which you are caching */
array('this','_cacheMiss') ); /* this is a function which is called to populate your cache. I cheated because i wasnt quite sure how to pass arguments to this function, so i just handled the caching procedurally below (this is probably not the best way to do it! */
if(is_null($cache->cache)){ //we don't have an existing cache, we need to renew it.
//handle caching
$contents = time(); //for the case of this example lets just use the timestamp...
$cache->setEntireCache($contents);
}
echo $cache->getContent(); //spit out the result.
Users browsing this forum: No registered users and 2 guests