object ICache.Load(IProgressIndicator progress, bool enablePersistence) { if (enablePersistence) { _persistentCache = new SimplePersistentCache <string>(_shellLocks, 1, "KarmaTest", _psiConfiguration); if (_persistentCache.Load(progress, _persistentIndexManager, (file, reader) => reader.ReadString(), (file, serialized) => { lock (_lock) { var info = new PersistentUnitTestSessionInfo(_solution, serialized); foreach (var element in info.Elements) { _elementsInFiles.AddValue(file, element); } _processedFiles.Add(file); _persistentCache.AddDataToSave(file, serialized); } }) != LoadResult.OK) { lock (_lock) { _elementsInFiles.Clear(); _processedFiles.Clear(); } } } return(null); }
public object Load(IProgressIndicator progress, bool enablePersistence) { if (!enablePersistence || _cacheFormatVersion < 0) { return(null); } Assertion.Assert(_persistentCache == null, "persistentCache == null"); _persistentCache = new SimplePersistentCache <TCacheData>( _shellLocks, _cacheFormatVersion, _cacheName, _psiConfiguration); if (_persistentCache.Load(progress, _persistentIndexManager, ReadData, Merge) != LoadResult.OK) { lock (_lockObject) { ClearCache(); return(null); } } // Any returned value will be passed to MergeLoaded, but we've already // merged as part of the load above return(null); }
void ICache.Save(IProgressIndicator progress, bool enablePersistence) { if (enablePersistence) { lock (_lock) { _persistentCache.Save(progress, _persistentIndexManager, (writer, file, data) => writer.Write(data)); } _persistentCache.Dispose(); _persistentCache = null; } }
public void Save(IProgressIndicator progress, bool enablePersistence) { if (!enablePersistence || _cacheFormatVersion < 0) { return; } Assertion.Assert(_persistentCache != null, "persistentCache != null"); lock (_lockObject) { _persistentCache.Save(progress, _persistentIndexManager, WriteData); } // Apparently, Save also implies throws away _persistentCache = null; }
void ICache.Save(IProgressIndicator progress, bool enablePersistence) { if (enablePersistence) { lock (_lock) { _persistentCache.Save(progress, _persistentIndexManager, (writer, file, data) => writer.Write(data)); } _persistentCache.Dispose(); _persistentCache = null; } }
object ICache.Load(IProgressIndicator progress, bool enablePersistence) { if (enablePersistence) { _persistentCache = new SimplePersistentCache<string>(_shellLocks, 1, "KarmaTest", _psiConfiguration); if (_persistentCache.Load(progress, _persistentIndexManager, (file, reader) => reader.ReadString(), (file, serialized) => { lock (_lock) { var info = new PersistentUnitTestSessionInfo(_solution, serialized); foreach (var element in info.Elements) { _elementsInFiles.AddValue(file, element); } _processedFiles.Add(file); _persistentCache.AddDataToSave(file, serialized); } }) != LoadResult.OK) { lock (_lock) { _elementsInFiles.Clear(); _processedFiles.Clear(); } } } return null; }