Example #1
0
        /// <summary>
        /// Notify all matched subscriptions and clean cache
        /// </summary>
        public void Notify()
        {
            var copy = Cache;

            Cache = new NotificationCache();

            foreach (var subscription in _subscriptions.Keys)
            {
                subscription.OnNextIfNeeded(copy);
            }
        }
Example #2
0
        internal void NotifyIfNeeded <T>(DocumentSubscription <T> documentSubscription, NotificationCache cache) where T : class
        {
            if (cache.Broadcasts.Contains(documentSubscription.Collection))
            {
                Notify(documentSubscription);
                return;
            }

            if (documentSubscription.Id is null)
            {
                return;
            }

            if (cache.Documents.Contains((documentSubscription.Collection, documentSubscription.Id)))
            {
                Notify(documentSubscription);
                return;
            }
        }
Example #3
0
        internal void NotifyIfNeeded <T>(CollectionSubscription <T> collectionSubscription, NotificationCache cache) where T : class
        {
            if (cache.Broadcasts.Contains(collectionSubscription.Collection))
            {
                Notify(collectionSubscription);
                return;
            }

            if (cache.Collections.Contains(collectionSubscription.Collection))
            {
                Notify(collectionSubscription);
                return;
            }
        }