/// <summary>Constructor</summary> /// <param name="capacity">the normal item limit for cache (Count may exeed capacity due to minAge)</param> /// <param name="minAge">the minimium time after an access before an item becomes eligible for removal, during this time /// the item is protected and will not be removed from cache even if over capacity</param> /// <param name="maxAge">the max time that an object will sit in the cache without being accessed, before being removed</param> /// <param name="isValid">delegate used to determine if cache is out of date. Called before index access not more than once per 10 seconds</param> public LruItemCache(int capacity, TimeSpan minAge, TimeSpan maxAge, IsValidFunc isValid) { if (capacity <= 0) { throw new ArgumentException("capacity MUST > 0"); } _capacity = capacity; _isValid = isValid; _lifeSpan = new LifespanMgr(this, minAge, maxAge); }
private CastedValidation(IsValidFunc wrappedValidation) { this.wrappedValidation = wrappedValidation; }