Beispiel #1
0
 /// <summary>
 /// crud opertion to redis with lock
 /// </summary>
 /// <typeparam name="T">return type of the Function</typeparam>
 /// <param name="fun">Fuction</param>
 /// <param name="errorMessage">error message used to override the default one</param>
 /// <returns></returns>
 private T DoWithLock <T>(Func <T> fun, string errorMessage = "Job Storage error")
 {
     try
     {
         _storage.LockWithWait();
         return(fun.Invoke());
     }
     catch (ObjectAlreadyExistsException)
     {
         throw;
     }
     catch (Exception ex)
     {
         throw new JobPersistenceException(errorMessage, ex);
     }
     finally
     {
         _storage.Unlock();
     }
 }