internal void updateStats(Func <GlobalStats, GlobalStats> globalUpdate, Func <CacheStats, CacheStats> statsUpdate) { lock (Nrdo.LockObj) { NrdoStats.UpdateGlobalStats(globalUpdate); cacheStats = statsUpdate(cacheStats); NrdoStats.allowCacheRebalance(); } }
public CacheStats Since(CacheStats prior) { if (prior == null) { return(this); } return(new CacheStats(prior.LatestGlobalStats.LatestOperationStamp, LatestGlobalStats, IsList, ListStats.Since(prior.ListStats), Hits - prior.Hits, NonHits - prior.NonHits, NonHitsOverCapacity - prior.NonHitsOverCapacity, Failures - prior.Failures, CumulativeTime - prior.CumulativeTime, CumulativeFailureTime - prior.CumulativeFailureTime, CumulativeCost - prior.CumulativeCost, ForeverNonHits, // The "forever" values don't get subtracted because calculation of average time requires them to never drop to zero ForeverCumulativeTime)); }
public CacheHitInfo(string method, IDBObjectCache cache) { this.method = method; this.cache = cache; this.cacheStats = cache is IListCache?CacheStats.CreateList() : CacheStats.CreateSingle(); }