Exemple #1
0
        public void Add(string key, TValue value)
        {
            Adjust(key);
            var result = new TrackValue <TValue>(this, value);

            cache.AddOrUpdate(key, result, (k, o) => result);
        }
Exemple #2
0
        public TValue Get(string key)
        {
            TrackValue <TValue> value = null;

            if (cache.TryGetValue(key, out value))
            {
                value.Age = Interlocked.Increment(ref currentAge);
            }

            return(value.Value);
        }