public static function render($path, $variables = array(), $uri = null) { if (moojon_cache::get_enabled() && $uri) { $cache_path = moojon_paths::get_cache_path($uri); if (moojon_cache::expired($uri)) { moojon_files::put_file_contents($cache_path, self::expose($path, $variables)); } return moojon_files::get_file_contents($cache_path); } else { return self::expose($path, $variables); } }
public static function expired($path, $absolute = false, $cache_for = null) { if (!$cache_for) { $cache_for = moojon_config::get('cache_for'); } if (!$absolute) { $path = moojon_paths::get_cache_path($path); } if (file_exists($path)) { if (time() > filectime($path) + $cache_for) { moojon_files::unlink($path); return true; } else { return false; } } else { return true; } }