Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@ -6,13 +6,14 @@ using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
namespace System.Runtime.Caching {
internal class MemoryCacheEntry: MemoryCacheKey {
const byte EntryStateMask = 0x1f;
private Object _value;
private DateTime _utcCreated;
private int _state;
// expiration
private DateTime _utcAbsExp;
private TimeSpan _slidingExp;
@ -69,8 +70,8 @@ namespace System.Runtime.Caching {
}
internal EntryState State {
get { return (EntryState)(_bits & EntryStateMask); }
set { _bits = (byte)(((uint)_bits & ~(uint)EntryStateMask) | (uint)value); }
get { return (EntryState)_state; }
set { _state = (int)value; }
}
internal byte UsageBucket {
@ -169,6 +170,10 @@ namespace System.Runtime.Caching {
}
}
internal bool CompareExchangeState(EntryState value, EntryState comparand) {
return (Interlocked.CompareExchange(ref _state, (int)value, (int)comparand) == (int)comparand);
}
// Associates this entry with an update sentinel. If this entry has a sliding expiration, we need to
// touch the sentinel so that it doesn't expire.
internal void ConfigureUpdateSentinel(MemoryCacheStore sentinelStore, MemoryCacheEntry sentinelEntry) {