private void ClearStorageIfRequested() { // check if cleanup was requested, do not change value if (Interlocked.CompareExchange(ref cleanupRequested, 1, 1) == 1) { _logger.Debug("Clearing storage"); _cleaner.Clear(_expiringKeys, _storage); Interlocked.Exchange(ref cleanupRequested, 0); } }
public void Manage(Backup backup, ICleaner cleaner, IStorage storage, ICreationPoint pointCreation) { var filesCopyInfo = storage.Save(backup.FilesPath); if (pointCreation is IncRestoreCreationPoint && backup.RestorePoints.Count == 0) { throw new UnavaliableIncPointCreation("No parent point"); } var restorePoint = pointCreation.Create(filesCopyInfo); backup.AddRestorePoint(restorePoint); cleaner.Clear(backup); }