Update a collection in the cache.
public updateCollection ( array $collection, array $options = [] ) | ||
$collection | array | The collection data to add/update. |
$options | array | Options: - newsynckey: (boolean) Set the new synckey in the collection. DEFAULT: false (Do not set the new synckey). - unsetChanges: (boolean) Unset the GETCHANGES flag in the collection. DEFAULT: false (Do not unset the GETCHANGES flag). - unsetPingChangeFlag: (boolean) Unset the PINGCHANGES flag in the collection. DEFUALT: false (Do not uset the PINGCHANGES flag). @since 2.3.0 |
/** * Update the syncCache with current collection data. */ public function updateCache() { foreach ($this->_collections as $value) { $this->_cache->updateCollection($value); } }
/** * Tests initiating a partial sync where 1 collection was passed from * client and 2 others had to be loaded from cache. */ protected function _testMissingCollections() { // Need to prime the cache with a synckey for contacts so we have // another one to load for the test. $col = array('id' => '@Contacts@', 'newsynckey' => '{517541cc-b188-478d-aaaa-fa49c0a8015f}35'); $cache = new Horde_ActiveSync_SyncCache(self::$state, 'dev123', 'mike', self::$logger->getLogger()); $cache->updateCollection($col, array('newsynckey' => true)); $cache->save(); $collections = $this->getCollectionHandler(); $col = array('id' => '519422f1-4c5c-4547-946a-1701c0a8015f', 'windowsize' => 5, 'truncation' => 0, 'mimesupport' => 0, 'mimetruncation' => 8, 'conflict' => 1, 'bodyprefs' => array('wanted' => 2, 2 => array('type' => 2, 'truncationsize' => 300000)), 'synckey' => '{517541cc-b188-478d-9e1a-fa49c0a8015f}3', 'deletesasmoves' => 1, 'filtertype' => 5); $collections->addCollection($col); $collections->initPartialSync(); $this->assertEquals(2, $collections->collectionCount()); }