Example #1
0
        public override void SetValue <TObject>(string key, TObject value, DistributedCacheEntryOptions options = null)
        {
            TimerContext timer = this.Helper.GetWriteTimer(Metrics.Distributed.WriteTimer);

            using (timer)
            {
                base.SetValue(key, value, options);
                timer.TrackUserValue("ok");
            }
        }
Example #2
0
        public override async Task SetValueAsync <TObject>(string key, TObject value, DistributedCacheEntryOptions options = null,
                                                           CancellationToken token = default(CancellationToken))
        {
            TimerContext timer = this.Helper.GetWriteTimer(Metrics.Distributed.WriteTimer);

            using (timer)
            {
                await base.SetValueAsync(key, value, options, token);

                timer.TrackUserValue("ok");
            }
        }
Example #3
0
        public override async Task <TObject> GetValueAsync <TObject>(string key, CancellationToken token = default(CancellationToken))
        {
            this.Helper.MarkTotalCount(Metrics.Distributed.TotalCount);
            TimerContext timer = this.Helper.GetReadTimer(Metrics.Distributed.ReadTimer);

            using (timer)
            {
                TObject result = await base.GetValueAsync <TObject>(key, token);

                if (result != null)
                {
                    timer.TrackUserValue("hit");
                    this.Helper.MarkHitCount(Metrics.Distributed.HitCount);
                }
                else
                {
                    timer.TrackUserValue("miss");
                }

                return(result);
            }
        }
Example #4
0
        public override TObject GetValue <TObject>(string key)
        {
            this.Helper.MarkTotalCount(Metrics.Distributed.TotalCount);
            TimerContext timer = this.Helper.GetReadTimer(Metrics.Distributed.ReadTimer);

            using (timer)
            {
                TObject result = base.GetValue <TObject>(key);

                if (result != null)
                {
                    timer.TrackUserValue("hit");
                    this.Helper.MarkHitCount(Metrics.Distributed.HitCount);
                }
                else
                {
                    timer.TrackUserValue("miss");
                }

                return(result);
            }
        }