Esempio n. 1
0
 public void Sweep()
 {
     if (_wasStarted)
     {
         return;
     }
     lock (_syncRoot)
     {
         if (_lastRun > DateTime.Now.AddMinutes(CleanPeriodInMinutes * -1))
         {
             return;
         }
         _wasStarted = true;
         try
         {
             _imageResizerService.DeleteExpiredCache();
             _lastRun = DateTime.Now;
             _settingsService.Settings.DeleteOldLastJobRun = _lastRun;
             _settingsService.SaveSettings();
         }
         catch (Exception e)
         {
             Logger.Error(e, "Amba.ImagePowerTools Cache cleanup task failed");
         }
         finally
         {
             _wasStarted = false;
         }
     }
 }
Esempio n. 2
0
 public ActionResult Settings(SettingsViewModel viewModel)
 {
     if (!ModelState.IsValid)
     {
         return(View(viewModel));
     }
     _settingsService.Settings.EnableFrontendResizeAction = viewModel.EnableFrontendResizeAction;
     _settingsService.Settings.MaxImageHeight             = viewModel.MaxImageHeight;
     _settingsService.Settings.MaxImageWidth = viewModel.MaxImageWidth;
     _settingsService.Settings.EnableContentItemFolderCleanup = viewModel.EnableContentItemFolderCleanup;
     _settingsService.SaveSettings();
     return(RedirectToAction("Settings"));
 }