コード例 #1
0
ファイル: CacheSynchronizer.cs プロジェクト: ronybot/caching
        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
ファイル: CacheSynchronizer.cs プロジェクト: pub-comp/caching
        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);
        }