コード例 #1
0
 public function writeFragment($key, $content)
 {
     if (!SFileUtils::mkdirs(dirname($key), 0700, true)) {
         throw new SException('Caching failed with dirs creation');
     }
     file_put_contents($key, $content);
 }
コード例 #2
0
 protected function cachePage($content = null, $options = array())
 {
     if (!$this->performCaching) {
         return;
     }
     if ($content == null) {
         $content = $this->response->body;
     }
     if (is_array($options)) {
         $path = $this->urlFor(array_merge($options, array('only_path' => true, 'skip_relative_url_root' => true)));
     } else {
         $path = $options;
     }
     if (!SFileUtils::mkdirs(dirname($this->pageCachePath($path)), 0700, true)) {
         throw new SException('Caching failed with dirs creation');
     }
     file_put_contents($this->pageCachePath($path), $content);
 }