public void Add(K key, V val) { lock (lockObject) { //remove excesses if (values.Count >= capacity) { RemoveFirst(); } //add to cache as normal ValueItem <K, V> cacheItem = new ValueItem <K, V>(val); cacheItem.keys.AddLast(key); values.AddLast(cacheItem); names.Add(key, cacheItem); } }
public NameItem(K k, ValueItem <K, V> v) { key = k; value = v; }