Beispiel #1
0
        private LRUCache(SerializationInfo srlzinfo, StreamingContext context)
        {
            if (null == srlzinfo)
            {
                throw new ArgumentNullException();
            }

            _maxSize           = srlzinfo.GetInt32(cstrMaxSize);
            _linkeddict        = srlzinfo.GetValue(cstrLinkedDict, typeof(LinkedDictionary <TK, LockableValue <TV> >)) as LinkedDictionary <TK, LockableValue <TV> >;
            _lrucacheentryhdlr = srlzinfo.GetValue(cstrCacheEntryHdlr, typeof(ILRUCacheEntryHandler <TK, TV>)) as ILRUCacheEntryHandler <TK, TV>;
            _autoPurge         = srlzinfo.GetBoolean(cstrAutoPurge);
            _currentSize       = srlzinfo.GetInt32(cstrCurrentSize);
        }
Beispiel #2
0
        /*
         * Construction/destruction.
         */
        public LRUCache(long maxSize, ILRUCacheEntryHandler <TK, TV> lrucacheentryhdlr, IEqualityComparer <TK> comparer)
        {
            if (0 == maxSize)
            {
                throw new ArgumentOutOfRangeException();
            }

            if (null == lrucacheentryhdlr)
            {
                throw new ArgumentNullException();
            }

            _maxSize           = maxSize;
            _linkeddict        = new LinkedDictionary <TK, LockableValue <TV> >(16 /* initial capacity */, comparer, true /* accessor order */, this);
            _lrucacheentryhdlr = lrucacheentryhdlr;
        }
Beispiel #3
0
 public LRUCache(long maxSize, ILRUCacheEntryHandler <TK, TV> lrucacheentryhdlr) : this(maxSize, lrucacheentryhdlr, null)
 {
 }