Exemplo n.º 1
0
        /// <summary>
        /// Merge the first entry i.e. c1 into c2
        /// </summary>
        /// <param name="c1"></param>
        /// <param name="c2"></param>
        /// <returns>returns merged entry c2</returns>
        public static CacheEntry MergeEntries(CacheEntry c1, CacheEntry c2)
        {
            if (c1 != null && c1.Notifications != null)
            {
                Notifications cbEtnry = c1.Notifications;

                if (cbEtnry.ItemRemoveCallbackListener != null)
                {
                    foreach (CallbackInfo cbInfo in cbEtnry.ItemRemoveCallbackListener)
                    {
                        c2.AddCallbackInfo(null, cbInfo, true);
                    }
                }
                if (cbEtnry.ItemUpdateCallbackListener != null)
                {
                    foreach (CallbackInfo cbInfo in cbEtnry.ItemUpdateCallbackListener)
                    {
                        c2.AddCallbackInfo(cbInfo, null, true);
                    }
                }
            }
            if (c1 != null && c1.EvictionHint != null)
            {
                if (c2.EvictionHint == null)
                {
                    c2.EvictionHint = c1.EvictionHint;
                }
            }
            return(c2);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Merge the first entry i.e. c1 into c2
        /// </summary>
        /// <param name="c1"></param>
        /// <param name="c2"></param>
        /// <returns>returns merged entry c2</returns>
        public static CacheEntry MergeEntries(CacheEntry c1, CacheEntry c2)
        {
            if (c1 != null && c1.Value is CallbackEntry)
            {
                CallbackEntry cbEtnry = null;
                cbEtnry = c1.Value as CallbackEntry;

                if (cbEtnry.ItemRemoveCallbackListener != null)
                {
                    foreach (CallbackInfo cbInfo in cbEtnry.ItemRemoveCallbackListener)
                    {
                        c2.AddCallbackInfo(null, cbInfo);
                    }
                }
                if (cbEtnry.ItemUpdateCallbackListener != null)
                {
                    foreach (CallbackInfo cbInfo in cbEtnry.ItemUpdateCallbackListener)
                    {
                        c2.AddCallbackInfo(cbInfo, null);
                    }
                }
            }
            if (c1 != null && c1.EvictionHint != null)
            {
                if (c2.EvictionHint == null)
                {
                    c2.EvictionHint = c1.EvictionHint;
                }
            }
            return(c2);
        }
Exemplo n.º 3
0
 public static CacheEntry MergeEntries(CacheEntry c1, CacheEntry c2)
 {
     if ((c1 != null) && (c1.Value is CallbackEntry))
     {
         CallbackEntry entry = null;
         entry = c1.Value as CallbackEntry;
         if (entry.ItemRemoveCallbackListener != null)
         {
             foreach (CallbackInfo info in entry.ItemRemoveCallbackListener)
             {
                 c2.AddCallbackInfo(null, info);
             }
         }
         if (entry.ItemUpdateCallbackListener != null)
         {
             foreach (CallbackInfo info2 in entry.ItemUpdateCallbackListener)
             {
                 c2.AddCallbackInfo(info2, null);
             }
         }
     }
     if (((c1 != null) && (c1.EvictionHint != null)) && (c2.EvictionHint == null))
     {
         c2.EvictionHint = c1.EvictionHint;
     }
     return(c2);
 }