/** * @param $component * @param $table_name * @param int $ttl */ protected function __construct($component, $table_name, $ttl = NULL) { $this->setTtl($ttl); $this->setComponent($component); $this->setTableName($table_name); $this->global_cache = ilGlobalCache::getInstance($component); $this->readFromCache(); if (!$this->getLoaded()) { $this->readFromDB(); $this->writeToCache(); $this->setLoaded(true); } }
/** * @return array|mixed */ public function get() { $ilGlobalCache = ilGlobalCache::getInstance(); if ($ilGlobalCache->isActive()) { $rec = $ilGlobalCache->get($this->cache_key); if (!$rec) { $rec = $this->getFromDb(); $ilGlobalCache->set($this->cache_key, $rec, 600); } } else { $rec = $this->getFromDb(); } return $rec; }
/** * @param $language_key */ protected function __construct($language_key) { $this->setLanguageKey($language_key); /** * @var $ilUser ilObjUser * @var $ilLog ilLog */ $this->global_cache = ilGlobalCache::getInstance(ilGlobalCache::COMP_CLNG); $this->readFromCache(); if (!$this->getLoaded()) { $this->readFromDB(); $this->writeToCache(); $this->setLoaded(true); } }
protected function initListeners() { require_once './Services/GlobalCache/classes/class.ilGlobalCache.php'; $ilGlobalCache = ilGlobalCache::getInstance(ilGlobalCache::COMP_EVENTS); $cached_listeners = $ilGlobalCache->get('listeners'); if (is_array($cached_listeners)) { $this->listener = $cached_listeners; return; } global $ilDB; $this->listener = array(); $sql = "SELECT * FROM il_event_handling" . " WHERE type = " . $ilDB->quote("listen", "text"); $res = $ilDB->query($sql); while ($row = $ilDB->fetchAssoc($res)) { $this->listener[$row["id"]][] = $row["component"]; } $ilGlobalCache->set('listeners', $this->listener); }
public static function flush() { ilGlobalCache::getInstance(ilGlobalCache::COMP_COMPONENT)->flush(); self::$instance = NULL; }
/** * Read object definition data */ function readDefinitionData() { if (ilGlobalCache::getInstance(ilGlobalCache::COMP_COMPONENT)->isActive()) { $this->readDefinitionDataFromCache(); } else { $this->readDefinitionDataFromDB(); } }
protected function __construct() { $this->global_cache = ilGlobalCache::getInstance(ilGlobalCache::COMP_ILCTRL); $this->readFromDB(); }