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); }
/* * 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; }