public void Set(CachedItem <T> item) { var previous = Replace(item); if (previous != null && previous != item) { _onEvict?.Invoke(previous); } }
public CachedItem <T> Replace(CachedItem <T> item) { return(Interlocked.Exchange(ref _current, item)); }