Ejemplo n.º 1
0
 public static SendFromCache TryGetCache(UserContext userContext, bool useInMemCache)
 {
     try
     {
         return(SendFromCache.GetCache(userContext, useInMemCache));
     }
     catch (Exception ex)
     {
         ExTraceGlobals.CoreCallTracer.TraceError <string, string>(0L, "Failed to get send from cache from server. Error: {0}. Stack: {1}", ex.Message, ex.StackTrace);
     }
     return(null);
 }
Ejemplo n.º 2
0
 public static void FinishSession(UserContext userContext)
 {
     if (userContext.IsSendFromCacheSessionStarted)
     {
         using (RecipientCacheTransaction recipientCacheTransaction = new RecipientCacheTransaction("OWA.SendFromCache", userContext))
         {
             SendFromCache sendFromCache = SendFromCache.TryGetCache(userContext);
             if (sendFromCache != null)
             {
                 sendFromCache.FinishSession(new SendFromCache(userContext, recipientCacheTransaction.Configuration), recipientCacheTransaction.Configuration);
             }
         }
     }
 }
Ejemplo n.º 3
0
 public override void Commit(bool mergeBeforeCommit)
 {
     if (base.IsDirty)
     {
         using (RecipientCacheTransaction recipientCacheTransaction = new RecipientCacheTransaction("OWA.SendFromCache", base.UserContext))
         {
             RecipientCache backEndRecipientCache = null;
             if (mergeBeforeCommit)
             {
                 backEndRecipientCache = new SendFromCache(base.UserContext, recipientCacheTransaction.Configuration);
             }
             this.Commit(backEndRecipientCache, recipientCacheTransaction.Configuration);
         }
     }
 }
Ejemplo n.º 4
0
 private static SendFromCache GetCache(UserContext userContext, bool useInMemCache)
 {
     if (userContext.SendFromCache == null || !useInMemCache)
     {
         using (RecipientCacheTransaction recipientCacheTransaction = new RecipientCacheTransaction("OWA.SendFromCache", userContext))
         {
             userContext.SendFromCache = SendFromCache.Load(userContext, recipientCacheTransaction.Configuration);
             if (!userContext.IsSendFromCacheSessionStarted)
             {
                 userContext.SendFromCache.StartCacheSession();
                 userContext.SendFromCache.Commit(recipientCacheTransaction.Configuration);
                 userContext.IsSendFromCacheSessionStarted = true;
             }
         }
     }
     return(userContext.SendFromCache);
 }
Ejemplo n.º 5
0
 public static SendFromCache TryGetCache(UserContext userContext)
 {
     return(SendFromCache.TryGetCache(userContext, true));
 }