Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestLRUInvalidateAndEvict (0.38 sec)

  1. tests/lru_test.go

    			lc.Add(fmt.Sprintf("key-%d", i/10), fmt.Sprintf("val-%d", i/10))
    			wg.Done()
    		}(i)
    	}
    	wg.Wait()
    	if lc.Len() != 100 {
    		t.Fatalf("length differs from expected")
    	}
    }
    
    func TestLRUInvalidateAndEvict(t *testing.T) {
    	var evicted int
    	lc := lru.NewLRU(-1, func(_, _ string) { evicted++ }, 0)
    
    	lc.Add("key1", "val1")
    	lc.Add("key2", "val2")
    
    	val, ok := lc.Get("key1")
    	if !ok {
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Sun May 25 07:40:40 UTC 2025
    - 10.4K bytes
    - Viewed (0)
Back to top