get($for); } /** * * @param File $file * @return string */ protected function getKey(File $file) { return md5($file->getFilename() ?? ''); } /** * * @param File $file * @return mixed */ public function load(File $file) { $key = $this->getKey($file); $cache = self::get_cache(); return $cache->get($key); } /** * @param File $file * @param string $content * @return string */ public function save(File $file, $content) { $lifetime = $this->config()->get('lifetime') ?: 3600; $key = $this->getKey($file); $cache = self::get_cache(); return $cache->set($key, $content, $lifetime); } /** * @return void */ public static function flush() { $cache = self::get_cache(); $cache->clear(); } /** * Alias for $this->flush() * * @return void */ public static function clear() { $cache = self::get_cache(); $cache->clear(); } /** * * @param File $file * @return bool */ public function invalidate(File $file) { $key = $this->getKey($file); $cache = self::get_cache(); return $cache->delete($key); } }