public static function get($key) { Trace::addMessage(self::TraceCategory, 'Start loading cache: ' . $key); $result = parent::get($key); Trace::addMessage(self::TraceCategory, 'Cache loaded: ' . $key); return $result; }
/** * Загружает всю таблицу в кеш сразу */ public static function loadAll() { try { // Если есть кеш, то грузим его $getCache = SimpleCache::get(SYSTEM_REGISTER_GET_CACHE); $childCache = SimpleCache::get(SYSTEM_REGISTER_CHILD_CACHE); self::$aGetCache = $getCache; self::$aChildCache = $childCache; return; } catch (SimpleCacheException $e) { } self::createCache(); }
public function testGuestCacheGeneratedOnUserUpdate() { $user = UserAccount::getByLogin('guest'); $paths = array(self::testReadRight => true, self::testWriteRight => true); $user->obj_rights->setValue($paths); // test that cache file not exists try { SimpleCache::get(ACLUser::CacheKey); $this->AssertTrue(false, 'seems like cache exists'); } catch (\Exception $e) { } $user->update(); $result = SimpleCache::get(ACLUser::CacheKey); // $this->assertTrue(in_array(self::testReadRight, $result)); $this->assertTrue(in_array(self::testWriteRight, $result)); }
protected static function loadGuestUserRights() { try { $actual = SimpleCache::isActual(self::CacheKey); } catch (SimpleCacheException $e) { $actual = false; } if (!$actual) { try { $user = UserAccount::getByLogin('guest'); $result = self::extractUserGrants($user); } catch (Exception $e) { CMSLog::addMessage('acl', $e); $result = array(); } SimpleCache::set(self::CacheKey, $result, self::CacheLifeTime); } else { $result = SimpleCache::get(self::CacheKey); } return $result; }