Horde_ActiveSync_SyncCache::refreshCollections PHP Method

refreshCollections() public method

Refresh the cached collections from the state backend.
public refreshCollections ( )
    public function refreshCollections()
    {
        $syncCache = $this->_state->getSyncCache($this->_devid, $this->_user, array('collections'));
        $cache_collections = !is_array($syncCache['collections']) ? array() : $syncCache['collections'];
        foreach ($cache_collections as $id => $cache_collection) {
            if (!isset($cache_collection['lastsynckey'])) {
                continue;
            }
            $cache_collection['id'] = $id;
            $cache_collection['synckey'] = $cache_collection['lastsynckey'];
            $this->_data['collections'][$id] = $cache_collection;
            $this->_markCollectionsDirty($id);
        }
        $this->_logger->info(sprintf('[%s] SyncCache collections refreshed.', $this->_procid));
    }

Usage Example

Esempio n. 1
0
 /**
  * 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];
         }
     }
 }
All Usage Examples Of Horde_ActiveSync_SyncCache::refreshCollections