util/lru: add Clear method

Updates tailscale/corp#20109

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I751a669251a70f0134dd1540c19b274a97608a93
This commit is contained in:
Andrew Dunham
2024-05-17 19:50:28 -04:00
parent c56e0c4934
commit 47b3476eb7
2 changed files with 10 additions and 0 deletions
+4
View File
@@ -47,6 +47,10 @@ func TestLRU(t *testing.T) {
if c.Contains(3) {
t.Errorf("contains 3; should not")
}
c.Clear()
if g, w := c.Len(), 0; g != w {
t.Errorf("Len = %d; want %d", g, w)
}
}
func TestLRUDeleteCorruption(t *testing.T) {