Beispiel #1
0
 public static RoomsCache TryGetCache(UserContext userContext, bool useInMemCache)
 {
     try
     {
         return(RoomsCache.GetCache(userContext, useInMemCache));
     }
     catch (Exception ex)
     {
         ExTraceGlobals.CoreCallTracer.TraceError <string, string>(0L, "Failed to get rooms cache from server. Error: {0}. Stack: {1}", ex.Message, ex.StackTrace);
     }
     return(null);
 }
 public override void AddEntry(RecipientInfoCacheEntry newEntry)
 {
     base.AddEntry(newEntry);
     if (0 < (newEntry.RecipientFlags & 2))
     {
         RecipientCache recipientCache = RoomsCache.TryGetCache(base.UserContext);
         if (recipientCache != null)
         {
             recipientCache.AddEntry(newEntry);
         }
     }
 }
Beispiel #3
0
 public static void FinishSession(UserContext userContext)
 {
     if (userContext.IsRoomsCacheSessionStarted)
     {
         using (RecipientCacheTransaction recipientCacheTransaction = new RecipientCacheTransaction("OWA.RoomsCache", userContext))
         {
             RoomsCache roomsCache = RoomsCache.TryGetCache(userContext);
             if (roomsCache != null)
             {
                 roomsCache.FinishSession(new RoomsCache(userContext, recipientCacheTransaction.Configuration), recipientCacheTransaction.Configuration);
             }
         }
     }
 }
Beispiel #4
0
 public override void Commit(bool mergeBeforeCommit)
 {
     if (base.IsDirty)
     {
         using (RecipientCacheTransaction recipientCacheTransaction = new RecipientCacheTransaction("OWA.RoomsCache", base.UserContext))
         {
             RecipientCache backEndRecipientCache = null;
             if (mergeBeforeCommit)
             {
                 backEndRecipientCache = new RoomsCache(base.UserContext, recipientCacheTransaction.Configuration);
             }
             this.Commit(backEndRecipientCache, recipientCacheTransaction.Configuration);
         }
     }
 }
Beispiel #5
0
 private static RoomsCache GetCache(UserContext userContext, bool useInMemCache)
 {
     if (userContext.RoomsCache == null || !useInMemCache)
     {
         using (RecipientCacheTransaction recipientCacheTransaction = new RecipientCacheTransaction("OWA.RoomsCache", userContext))
         {
             userContext.RoomsCache = RoomsCache.Load(userContext, recipientCacheTransaction.Configuration);
             if (!userContext.IsRoomsCacheSessionStarted)
             {
                 userContext.RoomsCache.StartCacheSession();
                 userContext.RoomsCache.Commit(recipientCacheTransaction.Configuration);
                 userContext.IsRoomsCacheSessionStarted = true;
             }
         }
     }
     return(userContext.RoomsCache);
 }
Beispiel #6
0
 public static RoomsCache TryGetCache(UserContext userContext)
 {
     return(RoomsCache.TryGetCache(userContext, true));
 }