public void Remove(object value) { base.CheckDisposed(); if (value == null) { throw new ArgumentNullException("value"); } Node node = null; lock (_indexList) { foreach (var index in _indexList) { if ((node = index.GetNode(value)) != null) { break; } } } bool isDupl = (node != null && node.Value == value); if (isDupl) { _lifeSpan.Remove(node); Interlocked.Decrement(ref _totalCount); } _lifeSpan.CheckValid(); }
/// <summary>Updates the status of the node to prevent it from being dropped from cache</summary> public void Touch() { if (Value != null && ageBag != _mgr._currentBag) { if (ageBag == null) { lock (_mgr) if (ageBag == null) { // if node.AgeBag==null then the object is not currently managed by LifespanMgr so add it next = _mgr._currentBag.first; _mgr._currentBag.first = this; Interlocked.Increment(ref _mgr._owner._curCount); } } ageBag = _mgr._currentBag; Interlocked.Increment(ref _mgr._currentSize); } _mgr.CheckValid(); }