/** * Updates data from the cache for collectons that are already loaded. Used * to ensure looping SYNC and PING requests are operating on the most * recent syncKey. */ public function updateCollectionsFromCache() { $this->_cache->refreshCollections(); $collections = $this->_cache->getCollections(); foreach (array_keys($this->_collections) as $id) { if (!empty($collections[$id])) { $this->_logger->info(sprintf('[%s] Refreshing %s from the cache.', $this->_procid, $id)); $this->_collections[$id] = $collections[$id]; } } }
protected function _testCacheRefreshCollections() { $cache = new Horde_ActiveSync_SyncCache(self::$state, 'dev123', 'mike', self::$logger->getLogger()); $newcache = new Horde_ActiveSync_SyncCache(self::$state, 'dev123', 'mike', self::$logger->getLogger()); $newcache->updateCollection(array('id' => '519422f1-4c5c-4547-946a-1701c0a8015f', 'newsynckey' => '{51941e99-0b9c-41f8-b678-1532c0a8015f}3'), array('newsynckey' => true)); sleep(1); $newcache->save(); $cache->refreshCollections(); $collection = $cache->getCollections(); $this->assertEquals($collection['519422f1-4c5c-4547-946a-1701c0a8015f']['lastsynckey'], '{51941e99-0b9c-41f8-b678-1532c0a8015f}3'); // Test timestamp $this->assertEquals(false, $cache->validateCache()); }