|
|
@ -151,6 +151,48 @@ func TestCache_basic(t *testing.T) { |
|
|
|
Keys: []string{"d", "e", "err"}, |
|
|
|
Stats: Stats{Hits: 3, Misses: 7}, |
|
|
|
}, |
|
|
|
}, { |
|
|
|
name: "reload-all a", |
|
|
|
key: "a", |
|
|
|
state: State{ |
|
|
|
Keys: []string{"a", "d", "e", "err"}, |
|
|
|
Stats: Stats{Hits: 3, Misses: 8}, |
|
|
|
}, |
|
|
|
}, { |
|
|
|
name: "reload-all b", |
|
|
|
key: "b", |
|
|
|
state: State{ |
|
|
|
Keys: []string{"a", "b", "e", "err"}, |
|
|
|
Stats: Stats{Hits: 3, Misses: 9}, |
|
|
|
}, |
|
|
|
}, { |
|
|
|
name: "reload-all c", |
|
|
|
key: "c", |
|
|
|
state: State{ |
|
|
|
Keys: []string{"a", "b", "c", "err"}, |
|
|
|
Stats: Stats{Hits: 3, Misses: 10}, |
|
|
|
}, |
|
|
|
}, { |
|
|
|
name: "reload-all d", |
|
|
|
key: "d", |
|
|
|
state: State{ |
|
|
|
Keys: []string{"a", "b", "c", "d"}, |
|
|
|
Stats: Stats{Hits: 3, Misses: 11}, |
|
|
|
}, |
|
|
|
}, { |
|
|
|
name: "read a again", |
|
|
|
key: "a", |
|
|
|
state: State{ |
|
|
|
Keys: []string{"b", "c", "d", "a"}, |
|
|
|
Stats: Stats{Hits: 4, Misses: 11}, |
|
|
|
}, |
|
|
|
}, { |
|
|
|
name: "read e, evicting b", |
|
|
|
key: "e", |
|
|
|
state: State{ |
|
|
|
Keys: []string{"c", "d", "a", "e"}, |
|
|
|
Stats: Stats{Hits: 4, Misses: 12}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|