示例#1
0
        public EvictItemsFromCacheBasedOnChanges(DocumentStore store, string databaseName)
        {
            _databaseName    = databaseName;
            _changes         = store.Changes(databaseName);
            _requestExecutor = store.GetRequestExecutor(databaseName);
            var docSub = _changes.ForAllDocuments();

            _documentsSubscription = docSub.Subscribe(this);
            var indexSub = _changes.ForAllIndexes();

            _indexesSubscription = indexSub.Subscribe(this);
        }
        public EvictItemsFromCacheBasedOnChanges(string databaseName, IDatabaseChanges changes, Action <string> evictCacheOldItems)
        {
            this.databaseName       = databaseName;
            this.changes            = changes;
            this.evictCacheOldItems = evictCacheOldItems;
            var docSub = changes.ForAllDocuments();

            documentsSubscription = docSub.Subscribe(this);
            var indexSub = changes.ForAllIndexes();

            indexesSubscription = indexSub.Subscribe(this);

            connectionTask = Task.Factory.ContinueWhenAll(new Task[] { docSub.Task, indexSub.Task }, tasks => { });
        }