public void Sweep() { if (_wasStarted) return; lock (_syncRoot) { if (_lastRun > DateTime.Now.AddMinutes(CleanPeriodInMinutes * -1)) { return; } _wasStarted = true; try { var resizeService = new ImageResizerService(_settingsService); resizeService.DeleteOldCache(); _lastRun = DateTime.Now; _settingsService.Settings.DeleteOldLastJobRun = _lastRun; _settingsService.SaveSettings(); } catch(Exception e) { Logger.Error(e, "Summit.Core Cache cleanup task failed"); } finally { _wasStarted = false; } } }
public void CacheDeleteOld() { var resizeService = new ImageResizerService(this.settingsService); resizeService.DeleteOldCache(); }