public QuotaServiceCache(IConfiguration Configuration, ICacheNotify <QuotaCacheItem> cacheNotify) { if (Configuration["core:enable-quota-cache"] == null) { QuotaCacheEnabled = true; } else { QuotaCacheEnabled = !bool.TryParse(Configuration["core:enable-quota-cache"], out var enabled) || enabled; } CacheNotify = cacheNotify; Cache = AscCache.Memory; Interval = new TrustInterval(); cacheNotify.Subscribe((i) => { if (i.Key == KEY_QUOTA_ROWS) { Interval.Expire(); } else if (i.Key == KEY_QUOTA) { Cache.Remove(KEY_QUOTA); } }, CacheNotifyAction.Any); }
public CachedQuotaService(IQuotaService service) { if (service == null) { throw new ArgumentNullException("service"); } this.service = service; cache = AscCache.Memory; interval = new TrustInterval(); CacheExpiration = TimeSpan.FromMinutes(10); cacheNotify = AscCache.Notify; cacheNotify.Subscribe <QuotaCacheItem>((i, a) => { if (i.Key == KEY_QUOTA_ROWS) { interval.Expire(); } else if (i.Key == KEY_QUOTA) { cache.Remove(KEY_QUOTA); } }); }
private void InvalidateCache(UserInfoCacheItem userInfo) { if (CoreBaseSettings.Personal && userInfo != null) { var key = GetUserCacheKeyForPersonal(userInfo.Tenant, userInfo.ID.FromByteString()); Cache.Remove(key); } TrustInterval.Expire(); }
private void InvalidateCache() { trustInterval.Expire(); }
public void SetTenantQuotaRow(TenantQuotaRow row, bool exchange) { service.SetTenantQuotaRow(row, exchange); interval.Expire(); }
public void InvalidateCache() { trustInterval.Expire(); }