示例#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);
 }
示例#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);
             }
         }
     }
 }
示例#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);
         }
     }
 }
示例#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);
 }
示例#5
0
 public static SendFromCache TryGetCache(UserContext userContext)
 {
     return(SendFromCache.TryGetCache(userContext, true));
 }