Update pkg/skills/search_cache_repro_test.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
8068b7dcfd
commit
35465ce924
1 changed files with 2 additions and 2 deletions
|
|
@ -16,12 +16,12 @@ func TestSearchCache_LRU_Behavior(t *testing.T) {
|
||||||
cache.Put("query-C", []SearchResult{{Slug: "C"}})
|
cache.Put("query-C", []SearchResult{{Slug: "C"}})
|
||||||
|
|
||||||
// Access query-A (should make it most recently used)
|
// Access query-A (should make it most recently used)
|
||||||
// Current behavior: query-A remains at front (oldest) if Get doesn't update order
|
// In correct LRU behavior, this access updates the order so query-A is not evicted next.
|
||||||
if _, found := cache.Get("query-A"); !found {
|
if _, found := cache.Get("query-A"); !found {
|
||||||
t.Fatal("query-A should be in cache")
|
t.Fatal("query-A should be in cache")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add query-D. Should evict query-A if FIFO (current bug), or query-B if LRU (desired).
|
// Add query-D. Correct LRU behavior should evict query-B (the least recently used).
|
||||||
cache.Put("query-D", []SearchResult{{Slug: "D"}})
|
cache.Put("query-D", []SearchResult{{Slug: "D"}})
|
||||||
|
|
||||||
// Check if query-A is still there
|
// Check if query-A is still there
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue