/** * Обновляет кеш детей * @param $bDelete boolean если установлен этот флаг, то хеши просто удаляются */ protected static function updateChildCache($id, $bDelete = false) { if ($bDelete) { if (isset(self::$aChildCache[$id])) { unset(self::$aChildCache[$id]); } return; } self::disableCache(); // Обновляем кеш детей self::selectChild($id); self::enableCache(); // Сохраняем кеш в файл SimpleCache::set(SYSTEM_REGISTER_CHILD_CACHE, self::$aChildCache); }
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; }
public static function clear($key) { Trace::addMessage(self::TraceCategory, 'Start cleaning cache: ' . $key); parent::clear($key); Trace::addMessage(self::TraceCategory, 'Cache deleted: ' . $key); }
public function testAutoloadInstance() { Configure::write(SimpleCache::ConfigurePath, array('Engine' => '\\Faid\\tests\\Cache\\TestCacheEngine')); $result = SimpleCache::getInstance(); $this->assertTrue($result instanceof TestCacheEngine); }