Exemple #1
0
 internal void updateStats(Func <GlobalStats, GlobalStats> globalUpdate, Func <CacheStats, CacheStats> statsUpdate)
 {
     lock (Nrdo.LockObj)
     {
         NrdoStats.UpdateGlobalStats(globalUpdate);
         cacheStats = statsUpdate(cacheStats);
         NrdoStats.allowCacheRebalance();
     }
 }
Exemple #2
0
        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));
        }
Exemple #3
0
 public CacheHitInfo(string method, IDBObjectCache cache)
 {
     this.method     = method;
     this.cache      = cache;
     this.cacheStats = cache is IListCache?CacheStats.CreateList() : CacheStats.CreateSingle();
 }