CampCacheList::fetchFromCache PHP Method

fetchFromCache() public method

Fetch list with the given parameters from cache.
public fetchFromCache ( ) : mixed
return mixed array $list List of items found in cache null List does not exist in cache
    public function fetchFromCache()
    {
        if (CampCache::IsEnabled()) {
            $list = CampCache::singleton()->fetch($this->getCacheKey());
            if ($list !== false && is_array($list)) {
                return $list;
            }
        }
        return false;
    }

Usage Example

Exemplo n.º 1
0
 public static function GetAll($p_reload = false)
 {
     global $g_ado_db;
     if (!$p_reload && is_array(self::$m_allPlugins)) {
         return self::$m_allPlugins;
     }
     if (!$p_reload && CampCache::IsEnabled()) {
         $cacheListObj = new CampCacheList(array(), self::CACHE_KEY_PLUGINS_ALL);
         self::$m_allPlugins = $cacheListObj->fetchFromCache();
         if (self::$m_allPlugins !== false && is_array(self::$m_allPlugins)) {
             return self::$m_allPlugins;
         }
     }
     $CampPlugin = new CampPlugin();
     $query = "SELECT Name FROM `" . $CampPlugin->m_dbTableName . "`";
     try {
         $res = $g_ado_db->execute($query);
         if (!$res) {
             return array();
         }
     } catch (Exception $e) {
         return array();
     }
     self::$m_allPlugins = array();
     while ($row = $res->FetchRow()) {
         self::$m_allPlugins[] = new CampPlugin($row['Name']);
     }
     if (!$p_reload && CampCache::IsEnabled()) {
         $cacheListObj->storeInCache(self::$m_allPlugins);
     }
     return self::$m_allPlugins;
 }
All Usage Examples Of CampCacheList::fetchFromCache