askew0

Untitled

May 19th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1.      <?php
  2.         $result = [];
  3.         $filter = ['IBLOCK_ID' => self::IBLOCK_ID, 'ID' => (int)$id];
  4.         $cache = Cache::createInstance();
  5.         $cacheId = 'cvzId=' . $id;
  6.         if($cache->initCache(self::CACHE_TIME, $cacheId, self::CACHE_PATH)) {
  7.             $res = $cache->getVars();
  8.             if($res && isset($res['result'])) {
  9.                 return $result;
  10.             }
  11.         }
  12.         $result = ElementTable::getList(['filter' => $filter])->fetch();
  13.         $cache->startDataCache(self::CACHE_TIME, $cacheId, self::CACHE_PATH);
  14.         $cache->endDataCache(['result' => $result]);
  15.         return $result;
Advertisement
Add Comment
Please, Sign In to add comment