public static FixedIdleExpiration Create(PoolManager poolManager, TimeSpan idleTime, DateTime absoluteTime) { var expiration = Create(poolManager); Construct(expiration, FixedExpiration.Create(poolManager, absoluteTime), IdleExpiration.Create(poolManager, idleTime)); return(expiration); }
public static ExpirationHint ReadExpHint(CompactReader reader, PoolManager poolManager) { ExpirationHintType expHint = ExpirationHintType.Parent; expHint = (ExpirationHintType)reader.ReadInt16(); switch (expHint) { case ExpirationHintType.NULL: return(null); case ExpirationHintType.Parent: return((ExpirationHint)reader.ReadObject()); case ExpirationHintType.FixedExpiration: var fe = FixedExpiration.Create(poolManager); fe.Deserialize(reader); return(fe); case ExpirationHintType.TTLExpiration: var ttle = TTLExpiration.Create(poolManager); ((ICompactSerializable)ttle).Deserialize(reader); return(ttle); case ExpirationHintType.FixedIdleExpiration: var fie = FixedIdleExpiration.Create(poolManager); ((ICompactSerializable)fie).Deserialize(reader); return(fie); #if !(DEVELOPMENT || CLIENT) case ExpirationHintType.NodeExpiration: var ne = NodeExpiration.Create(poolManager); ((ICompactSerializable)ne).Deserialize(reader); return(ne); #endif case ExpirationHintType.IdleExpiration: var ie = IdleExpiration.Create(poolManager); ((ICompactSerializable)ie).Deserialize(reader); return(ie); case ExpirationHintType.AggregateExpirationHint: var aeh = AggregateExpirationHint.Create(poolManager); ((ICompactSerializable)aeh).Deserialize(reader); return(aeh); case ExpirationHintType.DependencyHint: break; default: break; } return(null); }
private static ExpirationHint GetExpirationHint(PoolManager poolManager, DateTime absoluteExpiration, TimeSpan slidingExpiration) { ExpirationHint hint = null; if (ExpirationConstants.AbsoluteNoneExpiration.ToUniversalTime().Equals(absoluteExpiration) && ExpirationConstants.SlidingNoneExpiration.Equals(slidingExpiration)) { return(null); } if (!ExpirationConstants.AbsoluteNoneExpiration.ToUniversalTime().Equals(absoluteExpiration.ToUniversalTime())) { absoluteExpiration = absoluteExpiration.ToUniversalTime(); hint = FixedExpiration.Create(poolManager, absoluteExpiration); } else if (!ExpirationConstants.SlidingNoneExpiration.Equals(slidingExpiration)) { hint = IdleExpiration.Create(poolManager, slidingExpiration); } return(hint); }