Example #1
0
        private IEventHubQueueCache CacheFactory(string partition, IStreamQueueCheckpointer <string> checkpointer, Logger logger)
        {
            var evictionStrategy = new EHEvictionStrategyForTesting(this.logger, this.purgePredicate);

            this.evictionStrategyList.Add(evictionStrategy);
            var cache = new EventHubQueueCacheForTesting(checkpointer, new MockEventHubCacheAdaptor(this.serializationManager, this.bufferPool),
                                                         EventHubDataComparer.Instance, this.logger, evictionStrategy);

            cache.AddCachePressureMonitor(this.cachePressureInjectionMonitor);
            this.cacheList.Add(cache);
            return(cache);
        }
Example #2
0
        private IEventHubQueueCache CacheFactory(string partition, IStreamQueueCheckpointer <string> checkpointer, ILoggerFactory loggerFactory, ITelemetryProducer telemetryProducer)
        {
            var cacheLogger      = loggerFactory.CreateLogger($"{typeof(EventHubQueueCacheForTesting)}.{partition}");
            var evictionStrategy = new EHEvictionStrategyForTesting(cacheLogger, null, null, this.purgePredicate);

            this.evictionStrategyList.Add(evictionStrategy);
            var cache = new EventHubQueueCacheForTesting(checkpointer, new MockEventHubCacheAdaptor(this.serializationManager, this.bufferPool),
                                                         EventHubDataComparer.Instance, cacheLogger, evictionStrategy);

            cache.AddCachePressureMonitor(this.cachePressureInjectionMonitor);
            this.cacheList.Add(cache);
            return(cache);
        }