示例#1
0
文件: sample.php 项目: gudwin/extasy
 /**
  * Обновляет кеш детей
  * @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);
 }
示例#2
0
 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));
 }
示例#3
0
文件: user.php 项目: gudwin/extasy
 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;
 }
示例#4
0
 public static function clear($key)
 {
     Trace::addMessage(self::TraceCategory, 'Start cleaning cache: ' . $key);
     parent::clear($key);
     Trace::addMessage(self::TraceCategory, 'Cache deleted: ' . $key);
 }
示例#5
0
 public function testAutoloadInstance()
 {
     Configure::write(SimpleCache::ConfigurePath, array('Engine' => '\\Faid\\tests\\Cache\\TestCacheEngine'));
     $result = SimpleCache::getInstance();
     $this->assertTrue($result instanceof TestCacheEngine);
 }