Exemplo n.º 1
0
 public CachedAzService(DbAzService service, AzServiceCache azServiceCache)
 {
     this.service    = service ?? throw new ArgumentNullException("service");
     Cache           = azServiceCache.Cache;
     cacheNotify     = azServiceCache.CacheNotify;
     CacheExpiration = TimeSpan.FromMinutes(10);
 }
Exemplo n.º 2
0
        public IEnumerable <AzRecord> GetAces(int tenant, DateTime from)
        {
            var key  = AzServiceCache.GetKey(tenant);
            var aces = Cache.Get <AzRecordStore>(key);

            if (aces == null)
            {
                var records = service.GetAces(tenant, default);
                Cache.Insert(key, aces = new AzRecordStore(records), DateTime.UtcNow.Add(CacheExpiration));
            }
            return(aces);
        }