few minor MemoryCache perf improvements (#44797)
authorAdam Sitnik <adam.sitnik@gmail.com>
Wed, 18 Nov 2020 12:30:04 +0000 (13:30 +0100)
committerGitHub <noreply@github.com>
Wed, 18 Nov 2020 12:30:04 +0000 (13:30 +0100)
commit65efefda7ccac49fc0b66b60d089ca67ac6e484a
tree612ffb042bb2576803fc007a4a7ffbd0caa1394a
parent30769e8f31b20be10ca26e27ec279cd4e79412b9
few minor MemoryCache perf improvements (#44797)

* make ValidateCacheKey and CheckDisposed inlinable by moving throws to separate methods

* ensure that the check for expiration does not require a method call for the most common case

* update the last expiration scan when the Scan Task starts actual work

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCache.cs