Exemple #1
0
        public void AddReturnsTrueForPreviouslySeenValue()
        {
            LRUCacheSet <string> lru = new LRUCacheSet <string>(10);

            lru.Add("a");
            Assert.True(lru.Add("a"));
        }
Exemple #2
0
        public void OldestValueIsForgottenIfCapacityExceeded()
        {
            LRUCacheSet <string> lru = new LRUCacheSet <string>(2);

            lru.Add("a");
            lru.Add("b");
            lru.Add("c");
            Assert.True(lru.Add("c"));
            Assert.True(lru.Add("b"));
            Assert.False(lru.Add("a"));
        }
Exemple #3
0
        public void ValueBecomesNewEachTimeItIsAdded()
        {
            LRUCacheSet <string> lru = new LRUCacheSet <string>(2);

            lru.Add("a");
            lru.Add("b");
            lru.Add("a");
            lru.Add("c");
            Assert.True(lru.Add("c"));
            Assert.True(lru.Add("a"));
            Assert.False(lru.Add("b"));
        }
Exemple #4
0
        public void AddReturnsFalseForNeverSeenValue()
        {
            LRUCacheSet <string> lru = new LRUCacheSet <string>(10);

            Assert.False(lru.Add("a"));
        }
 internal DefaultUserDeduplicator(int userKeysCapacity, TimeSpan userKeysFlushInterval)
 {
     _userKeys      = new LRUCacheSet <string>(userKeysCapacity);
     _flushInterval = userKeysFlushInterval;
 }