Example #1
0
 public function flushCache()
 {
     if ($this->hasAnyColumnChanged()) {
         $this->setMenu();
         $this->menu->flushMenuCache();
     }
     $html = '';
     $filename = str_replace('/', '_', substr($this->get('URL'), 1));
     if ($this->get('URL') === '/project') {
         if (!$this->projects) {
             $this->projects = Project::getEntireCollection();
         }
         $html .= $this->projects->getHTML();
     } else {
         $this->setElements();
         $html .= implode('', array_map(function ($el) {
             return $el->getHTML();
         }, $this->elements));
     }
     file_put_contents(CACHE_DIR . "/{$filename}.cache", $html);
 }