public enum CacheEventType { ADD, REMOVE } public class Cache<K, V> { public const int CheckInterval = 1000; private int _timeoutSeconds; private SortedList<Timeout, K> timeouts = new SortedList<Timeout, K>(); private Dictionary<K, V> items = new Dictionary<K, V>(); private Timer timer; private object locker = new object (); public delegate void CacheEventHandler( object source, CacheEvent<K, V> e); public event CacheEventHandler changed; public Cache( int timeoutSeconds) : this (timeoutSeconds,CheckInterval){} public Cache( int timeoutSeconds, int checkInterval) { this ._timeoutSeconds = timeoutSeconds; timer = new Timer(PurgeCache, " Cache ", checkInterval, checkInterval); //purge cache } private void PurgeCache( object data) { lock (locker) { for ( int i = timeouts.Count - 1; i >= 0; i--) { if (timeouts.Keys[i].IsExpired()) ...