Created
February 28, 2013 09:09
-
-
Save einarwh/5055376 to your computer and use it in GitHub Desktop.
ExpirationCache outline.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Simple LRU cache with expiring elements. | |
/// </summary> | |
public class ExpirationCache<TKey, TValue> where TValue : class | |
{ | |
private readonly Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TimeStamped<TValue>>>> _dict | |
= new Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TimeStamped<TValue>>>>(); | |
private readonly LinkedList<KeyValuePair<TKey, TimeStamped<TValue>>> _list | |
= new LinkedList<KeyValuePair<TKey, TimeStamped<TValue>>>(); | |
private readonly TimeSpan _lifetime; | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment