Пример #1
0
        private bool CacheUpdated(CacheItemNotification notification)
        {
            System.Diagnostics.Debug.WriteLine("Incoming Notification::From:{0}, Cache:{1}, Key:{2}, Action:{3}",
                                               notification.Sender,
                                               notification.CacheName,
                                               String.IsNullOrEmpty(notification.Key) ? "undefined" : notification.Key,
                                               notification.Action.ToString());

            if (notification.Action == CacheItemActionTypes.RemoveAll)
            {
                cache.ClearAll();
            }
            else
            {
                cache.Clear(notification.Key);
            }
            return(true);
        }
Пример #2
0
        private bool OnCacheUpdated(CacheItemNotification notification)
        {
            if (!this.cache.Name.Equals(notification.CacheName, StringComparison.InvariantCultureIgnoreCase))
            {
                return(false);
            }

            System.Diagnostics.Debug.WriteLine("Incoming Notification::From:{0}, Cache:{1}, Key:{2}, Action:{3}",
                                               notification.Sender,
                                               notification.CacheName,
                                               String.IsNullOrEmpty(notification.Key) ? "undefined" : notification.Key,
                                               notification.Action.ToString());

            if (notification.Action == CacheItemActionTypes.RemoveAll)
            {
                cache.ClearAll();
            }
            else
            {
                cache.Clear(notification.Key);
            }

            return(true);
        }