/// <summary> /// Check if the provided eviction hint is compatible with the policy /// and return the compatible eviction hint /// </summary> /// <param name="eh">eviction hint.</param> /// <returns>a hint compatible to the eviction policy.</returns> public EvictionHint CompatibleHint(EvictionHint eh, PoolManager pool) { if (eh != null && eh is PriorityEvictionHint) { return(eh); } return(PriorityEvictionHint.Create(pool, _priority)); }
//#endregion public static EvictionHint ReadEvcHint(CompactReader reader, PoolManager poolManager) { EvictionHintType expHint = EvictionHintType.Parent; expHint = (EvictionHintType)reader.ReadInt16(); EvictionHint tmpObj = null; switch (expHint) { case EvictionHintType.NULL: return(null); case EvictionHintType.Parent: tmpObj = (EvictionHint)reader.ReadObject(); return(tmpObj); case EvictionHintType.CounterHint: var ch = CounterHint.Create(poolManager); ((ICompactSerializable)ch).Deserialize(reader); return(ch); case EvictionHintType.PriorityEvictionHint: var peh = PriorityEvictionHint.Create(poolManager); ((ICompactSerializable)peh).Deserialize(reader); return(peh); case EvictionHintType.TimestampHint: var tsh = TimestampHint.Create(poolManager); ((ICompactSerializable)tsh).Deserialize(reader); return(tsh); default: break; } return(null); }