예제 #1
0
        public async Task Test1()
        {
            var settings = new CacheSettings(100, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(30));
            var cache    = new GreenCache <Endpoint>(settings);

            IIndex <Uri, Endpoint> addressIndex = cache.AddIndex("address", x => x.Address);

            var address = new Uri("rabbitmq://localhost/vhost/input-queue");

            cache.Add(new Endpoint {
                Address = address
            });


            var endpoint = await addressIndex.Get(address, key => Task.FromResult(new Endpoint {
                Address = key
            }));
        }
예제 #2
0
파일: Tests.cs 프로젝트: zzms/MassTransit
        public async Task Test1()
        {
            var cache = new GreenCache <Endpoint>(100, TimeSpan.FromSeconds(60), TimeSpan.FromMinutes(30),
                                                  () => DateTime.UtcNow);

            var addressIndex = cache.AddIndex("address", x => x.Address);

            var address = new Uri("rabbitmq://localhost/vhost/input-queue");

            cache.Add(new Endpoint {
                Address = address
            });


            var endpoint = await addressIndex.Get(address, key => Task.FromResult(new Endpoint {
                Address = key
            }));
        }