Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 73882dae8d | |||
| c200f51afd |
2
go.mod
2
go.mod
@@ -2,4 +2,4 @@ module git.wntrmute.dev/kyle/go-mru
|
||||
|
||||
go 1.17
|
||||
|
||||
require github.com/benbjohnson/clock v1.3.5
|
||||
require github.com/benbjohnson/clock v1.3.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -1,2 +1,2 @@
|
||||
github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o=
|
||||
github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
|
||||
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
|
||||
4
mru.go
4
mru.go
@@ -53,10 +53,6 @@ func (c *Cache) Len() int {
|
||||
|
||||
// evict should remove the least-recently-used cache item.
|
||||
func (c *Cache) evict() {
|
||||
if c.access.Len() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
k := c.access.K(0)
|
||||
c.evictKey(k)
|
||||
}
|
||||
|
||||
@@ -20,11 +20,6 @@ func TestBasicCacheEviction(t *testing.T) {
|
||||
t.Fatal("cache should have size 0")
|
||||
}
|
||||
|
||||
c.evict()
|
||||
if err := c.ConsistencyCheck(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
c.Store("raven", 1)
|
||||
if err := c.ConsistencyCheck(); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user