/// <summary> /// Given a purge cached message, indicates whether it should be purged from the cache. /// </summary> protected virtual bool ShouldPurge(ref CachedMessage cachedMessage, ref CachedMessage newestCachedMessage, DateTime nowUtc) { TimeSpan timeInCache = nowUtc - cachedMessage.DequeueTimeUtc; // age of message relative to the most recent event in the cache. TimeSpan relativeAge = newestCachedMessage.EnqueueTimeUtc - cachedMessage.EnqueueTimeUtc; return(timePurge.ShouldPurgFromTime(timeInCache, relativeAge)); }
// Given a purge cached message, indicates whether it should be purged from the cache private bool ShouldPurge(ref TCachedMessage cachedMessage, ref TCachedMessage newestCachedMessage, DateTime nowUtc) { TimeSpan timeInCache = nowUtc - GetDequeueTimeUtc(ref cachedMessage); // age of message relative to the most recent event in the cache. TimeSpan relativeAge = GetEnqueueTimeUtc(ref newestCachedMessage) - GetEnqueueTimeUtc(ref cachedMessage); return(timePurge.ShouldPurgFromTime(timeInCache, relativeAge)); }