Beispiel #1
0
        public async Task <Dictionary <string, int> > GetRouteEntries()
        {
            return(await _cache.GetOrCreateAsync("GetRouteEntries", async entry =>
            {
                entry.SetSlidingExpiration(TimeSpan.FromSeconds(10));
                entry.AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(20);

                var result = await _ctx.ExecuteStoredProcedureCollectionReader <RouteEntry>("USP_Select_RouteEntry");

                return result?.ToDictionary(x => x.Code, x => x.Id);
            }));
        }