Beispiel #1
0
        protected async Task RunWithConfigurationTwoCaches <TCacheItem>(
            ICacheManagerConfiguration configuration,
            Func <ICacheManager <TCacheItem>, ICacheManager <TCacheItem>, EventCounter <TCacheItem>, EventCounter <TCacheItem>, Task> job)
        {
            var cache  = CacheFactory.FromConfiguration <TCacheItem>("CacheA", configuration);
            var cache2 = CacheFactory.FromConfiguration <TCacheItem>("CacheB", configuration);

            var handlingA = new EventCounter <TCacheItem>(cache);
            var handlingB = new EventCounter <TCacheItem>(cache2);

            Func <Task> task = () => Task.Run(async() => await job(cache, cache2, handlingA, handlingB));

            await Runner(task, handlingA, handlingB);
        }
Beispiel #2
0
        protected async Task RunWithConfigurationOneCache <TCacheItem>(
            ICacheManagerConfiguration configuration,
            Action <ICacheManager <TCacheItem>, EventCounter <TCacheItem> > job)
        {
            var cache = CacheFactory.FromConfiguration <TCacheItem>("CacheA", configuration);

            cache.Clear();

            var handlingA = new EventCounter <TCacheItem>(cache);

            Func <Task> task = () => Task.Run(() => job(cache, handlingA));

            await Runner(task, handlingA);
        }