Example #1
0
File: Cache.php Project: enozoom/es
 /**
  * 保存缓存
  * 如果页面内容小于1KB,则不被缓存即使满足缓存条件
  * @param string $html
  * @param int $len 文件最小存储限制
  */
 public function save($html, $len = 1024)
 {
     if ($this->is_allow_cache() && mb_strlen($html, 'UTF-8') > $len) {
         $file = $this->cache_file_path();
         $html = FileStatic::cleanHtmlblank($html);
         $es = PHP_EOL . "<!--[[" . ES_POWER . ' ' . ES_AUTHOR . ' ' . TimeStatic::formatTime() . ' ' . $this->cache_file_rule() . time() . "]]-->";
         // 该值用以判断是否过期
         file_put_contents($file, $html . $es);
     }
 }