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 })); }
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 })); }