Validate the cache. Compares the cache timestamp with the current cache
timestamp in the state backend. If the timestamps are different, some
other request has modified the cache, so it should be invalidated.
public validateCache ( boolean $hb_only = false ) : boolean | ||
$hb_only | boolean | If true, only validate the hb timestamps. @since 2.4.0 |
return | boolean |
/** * Save the syncCache to storage. * * @param boolean $preserve_folders If true, ensure the folder cache is not * overwritten. @since 2.18.0 * @todo Refactor this hack away. Requires a complete refactor of the cache. */ public function save($preserve_folders = false) { // HOTFIX. Need to check the timestamp to see if we should reload the // folder cache before saving to ensure it isn't overwritten. See // Bug: 13273 if ($preserve_folders && !$this->_cache->validateCache()) { $this->_logger->info(sprintf('[%s] Updating the foldercache before saving.', $this->_procid)); $this->_cache->refreshFolderCache(); } $this->_cache->save(); }
protected function _testValidateAfterUpdateTimestamp() { $cache = new Horde_ActiveSync_SyncCache(self::$state, 'dev123', 'mike', self::$logger->getLogger()); $this->assertEquals(true, $cache->validateCache()); $cache->updateTimestamp(); $this->assertEquals(true, $cache->validateCache()); }