public CacheEntryIdentifier(string key, LRUCacheOptions options) { if (key == null) { throw new ArgumentNullException(nameof(key)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } Key = key; Id = options.HashCodeGenerator(key); }
public static CacheEntry New(string key, object value, TimeSpan timeSpan, LRUCacheOptions options = null) { var indentifier = new CacheEntryIdentifier(key, options ?? new LRUCacheOptions()); return(new CacheEntry(indentifier, value, timeSpan)); }
public LRUCacheStore(LRUCacheOptions options) { wrLock = new ReaderWriterLockSlim(); this.options = options; cacheEntries = new LRUCollection <CacheEntry>(options.MaxSize, options.DataPersist?.RestoreItems()); }
public LRUCache(LRUCacheOptions options = null, ICacheStore cacheStore = null) { this.options = options ?? new LRUCacheOptions(); this.cacheStore = cacheStore ?? new LRUCacheStore(this.options); }