think\Template::isCache PHP Method

isCache() public method

检查编译缓存是否存在
public isCache ( string $cacheId ) : boolean
$cacheId string 缓存的id
return boolean
    public function isCache($cacheId)
    {
        if ($cacheId && $this->config['display_cache']) {
            // 缓存页面输出
            return Cache::has($cacheId);
        }
        return false;
    }

Usage Example

Example #1
0
 public function testIsCache()
 {
     $template = new Template(['cache_id' => '__CACHE_ID__', 'display_cache' => true]);
     $this->assertTrue($template->isCache('__CACHE_ID__'));
     $template->display_cache = false;
     $this->assertTrue(!$template->isCache('__CACHE_ID__'));
 }