| | |
| | | /// </summary> |
| | | public void Wipe() |
| | | { |
| | | if (this._isWiping) { return; } |
| | | if (_isWiping) { return; } |
| | | |
| | | lock (this._wipeLock) |
| | | lock (_wipeLock) |
| | | { |
| | | if (this._isWiping) { return; } |
| | | if (_isWiping) { return; } |
| | | |
| | | this._isWiping = true; |
| | | _isWiping = true; |
| | | |
| | | SpinWait.SpinUntil(() => !this._isSetting); // wait until all running set operations are complete (new ones are blocked) |
| | | SpinWait.SpinUntil(() => !_isSetting); // wait until all running set operations are complete (new ones are blocked) |
| | | |
| | | var keys = this._memoryCache.Select(x => x.Key); |
| | | var keys = _memoryCache.Select(x => x.Key); |
| | | |
| | | Parallel.ForEach(keys, x => ((IMemoryCacheDirect)this).Remove(x)); |
| | | |
| | |
| | | } |
| | | finally |
| | | { |
| | | this._isWiping = false; |
| | | _isWiping = false; |
| | | } |
| | | } |
| | | } |