protected virtual CacheMethodTaken TryGetScopedInner <TValue>(String key, out ScopedValue <TValue> value) { var directives = CacheDirectives.CurrentScope; if (!directives.Method.HasFlag(CacheMethod.Get)) { value = default; return(CacheMethodTaken.None); } if (InnerCache.Get(key, regionName: null) is ScopedValue <TValue> scopedValue && directives.IsInScope(scopedValue)) { value = scopedValue; return(CacheMethodTaken.Get); } value = default; return(CacheMethodTaken.GetMiss); }
public CacheMethodTaken TryGetScoped <TValue>(String key, out ScopedValue <TValue> value) { return(TryGetScopedInner(key, out value)); }
public CacheMethodTaken SetScoped <TValue>(String key, ScopedValue <TValue> scopedValue) => SetScoped(key, scopedValue.Value, scopedValue.ValueTimestamp);
public BusyService() { this.isBusy = new ScopedValue <bool>(); this.isBusy.ValueStarted += OnBusyStarted; this.isBusy.ValueEnded += OnBusyEnded; }
public Service1(ScopedValue scopedValue) => ScopedValue = scopedValue;
public CacheMethodTaken TryGetScoped<TValue>(string key, out ScopedValue<TValue> scopedValue) { return innerCache.TryGetScoped(key, out scopedValue); }
protected override CacheMethodTaken TryGetScopedInner<TValue>(string key, out ScopedValue<TValue> value) { var cacheMethodTaken = base.TryGetScopedInner(key, out value); if (cacheMethodTaken.HasFlag(CacheMethodTaken.Get)) hits++; if (cacheMethodTaken.HasFlag(CacheMethodTaken.GetMiss)) misses++; return cacheMethodTaken; }