示例#1
0
        public bool TryGetValue(TKey key, out TimedValue <TValue> value, bool updateAccessTime = true)
        {
            TimedValue <TValue> timedValue;

            if (!_dict.TryGetValue(key, out timedValue))
            {
                value = null;
                return(false);
            }

            if (updateAccessTime)
            {
                timedValue.UpdateAccessTime();
            }
            value = timedValue;
            return(true);
        }
示例#2
0
 public TValue this[TKey key]
 {
     get { return(_dict[key].Value); }
     set { _dict[key] = new TimedValue <TValue>(value, DefaultExpiry); }
 }