private bool CommitSync(out int numDeleted, out int numUpdated, out long numBytesWritten) { var numDeletedLocal = 0; var numUpdatedLocal = 0; long numBytesWrittenLocal = 0; void LocalCommit(IStorageProxyCacheCommit committer) { try { var numDeletedInternal = 0; var numUpdatedInternal = 0; long numBytesWrittenInternal = 0; committer?.Commit(out numDeletedInternal, out numUpdatedInternal, out numBytesWrittenInternal); numDeletedLocal += numDeletedInternal; numUpdatedLocal += numUpdatedInternal; numBytesWrittenLocal += numBytesWrittenInternal; } catch (Exception e) { _log.LogError(e, $"Exception thrown committing changes to Ignite for {committer?.Name}"); throw; } } CommittableCaches.ForEach(LocalCommit); numDeleted = numDeletedLocal; numUpdated = numUpdatedLocal; numBytesWritten = numBytesWrittenLocal; return(true); }
/// <summary> /// Determine the amount of bytes that will be written as a result of Commit() /// </summary> public long PotentialCommitWrittenBytes() { long numBytes = 0; CommittableCaches.ForEach(x => numBytes += x.PotentialCommitWrittenBytes()); return(numBytes); }
/// <summary> /// Clears all changes in the spatial and non spatial stores /// </summary> public override void Clear() { void LocalClear(IStorageProxyCacheCommit committer) { try { committer?.Clear(); } catch { _log.LogError($"Exception thrown clearing changes for cache {committer?.Name}"); throw; } } CommittableCaches.ForEach(LocalClear); ImmutableProxy?.Clear(); }