private async Task AddDataIntoCache(EventHubQueueCacheForTesting cache, int count) { await Task.Delay(10); List <EventData> messages = Enumerable.Range(0, count) .Select(i => MakeEventData(i)) .ToList(); cache.Add(messages, DateTime.UtcNow); }
private Task AddDataIntoCache(EventHubQueueCacheForTesting cache, int count) { while (count > 0) { count--; //just to make compiler happy byte[] ignore = { 12, 23 }; cache.Add(new EventData(ignore), DateTime.UtcNow); } return(TaskDone.Done); }
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); }
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); }
private async Task AddDataIntoCache(EventHubQueueCacheForTesting cache, int count) { await Task.Delay(10); int sequenceNumber = 0; while (count > 0) { count--; //just to make compiler happy byte[] ignore = { 12, 23 }; var eventData = new EventData(ignore); DateTime now = DateTime.UtcNow; var offSet = Guid.NewGuid().ToString() + now.ToString(); eventData.SetOffset(offSet); //set sequence number eventData.SetSequenceNumber(sequenceNumber++); //set enqueue time eventData.SetEnqueuedTimeUtc(now); cache.Add(eventData, DateTime.UtcNow); } }