/** * Checks the cache for the widget data. * If cache exists, it sets the TemplateData. * * @return string */ public function isCached() { if (!$this->cacheDir) { return false; } $cache = new CacheStorageHelper($this->cacheDir, $this->uniqueCacheDir); $data = $cache->get($this->getUniqueWidgetId(), $this->cacheTimeout); if ($data) { $this->widget->setCached(true); $this->setTemplateData($data, true); return true; } return false; }
/** * Clears the temporary widget cache */ public function clearDashboardCache() { $cacheDir = $this->factory->getParameter('cached_data_dir', $this->factory->getSystemPath('cache', true)); $cacheStorage = new CacheStorageHelper($cacheDir, $this->factory->getUser()->getId()); $cacheStorage->clear(); }