Exemplo n.º 1
0
 public IntIndexAutoTimeoutSet(int timeout)
 {
     if (timeout < 1000)
     {
         throw new ArgumentOutOfRangeException("timeout", "timeout参数取值不能小于1000ms");
     }
     _timeOut         = timeout;
     _cacheCollection = new Dictionary <int, TimeoutItem <int, TValue> >();
     timerPoolItem    = _timerPool.Add(1000, timerCallback, null, true);
 }
        public AutoTimeoutDictionary(int capacity = 16, int defaultTimeout = 10000, IEqualityComparer <TKey> comparer = null)
        {
            if (comparer != null)
            {
                _cacheValue = new Dictionary <TKey, TimeoutItem <TKey, TValue> >(capacity, comparer);
            }
            else
            {
                _cacheValue = new Dictionary <TKey, TimeoutItem <TKey, TValue> >(capacity);
            }

            //_collection = (ICollection<KeyValuePair<TKey, TValue>>) _cacheValue;
            _defaultTimeout = defaultTimeout;
            _timerPoolItem  = _timerPool.Add(500, timerCallback, null);
        }
 public AutoTimeoutCollection()
 {
     timerPoolItem = _timerPool.Add(500, timerCallback, null, true);
 }