/** * Starts caching off. Returns true if cached, and dumps * the output. False if not cached and start output buffering. * * @param string $group Group to store data under * @param string $id Unique ID of this data * @param int $ttl How long to cache for (in seconds) * @return bool True if cached, false if not */ public static function Start($group, $id, $ttl) { if (self::isCached($group, $id)) { $data = self::read($group, $id); if (self::$gzip_level > 0) { $data = gzcompress($data); } echo $data; return true; } else { ob_start(); self::$group = $group; self::$id = $id; self::$ttl = $ttl; return false; } }
/** * Starts caching off. Returns true if cached, and dumps * the output. False if not cached and start output buffering. * * @param string $group Group to store data under * @param string $id Unique ID of this data * @param int $ttl How long to cache for (in seconds) * @return bool True if cached, false if not */ public static function Start($group, $id, $ttl) { if (self::isCached($group, $id)) { echo self::read($group, $id); return true; } else { ob_start(); self::$group = $group; self::$id = $id; self::$ttl = $ttl; return false; } }