/** * Gets a folder cache id * @param integer $folderId */ public function getFolderCacheId($folderId) { return Tinebase_Helper::arrayToCacheId(array(self::EXPRESSOMAIL_MODEL_FOLDER, $folderId)); }
/** * Create Expressomail_Model_Account cache id * * @param string Expressomail Model Account id * @return string cache id */ protected function _createExpressomailModelAccountCacheId($_id) { return Tinebase_Helper::arrayToCacheId(array(Tinebase_Core::getUser()->accountId, $_id)); }
/** * get nodes from cache * if cache miss or cache etag is outdated, updates cache with nodes from backend * * @param string $path path * @param string $etag hash etag * @return array of nodes */ private function getNodesFromCache($path, $etag) { $cache = Tinebase_Core::get('cache'); $cacheId = Tinebase_Helper::arrayToCacheId(array(self::GETEXPRESSODRIVEETAGS, sha1(Tinebase_getUser()->getId()) . $this->encodePath($path))); $result = $cache->load($cacheId); if (!$result) { $result = $this->getNodesFromBackend($path); $cache->save($result, $cacheId, array(self::EXPRESSODRIVEETAGS), $this->cacheLifetime); } else { if ($result[0]['hash'] != $etag) { $result = $this->getNodesFromBackend($path); $cache->save($result, $cacheId, array(self::EXPRESSODRIVEETAGS), $this->cacheLifetime); } } return $result; }