Skip to content

Commit

Permalink
fix order
Browse files Browse the repository at this point in the history
  • Loading branch information
creachadair committed Sep 6, 2024
1 parent 19ad4c1 commit 0b7ee7a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func (c *Cache[Key, Value]) Put(key Key, val Value) bool {

// If there is an existing item for this key, remove it.
if old, ok := c.store.Check(key); ok {
c.size -= c.sizeOf(old)
c.store.Remove(key)
c.size -= c.sizeOf(old)
c.onEvict(key, old)
c.count--
}
Expand Down Expand Up @@ -187,7 +187,7 @@ type Store[Key comparable, Value any] interface {
// This counts as an access of the value.
//
// If key is already present, Store should panic.
// This should not be possible.
// That condition should not be possible.
Store(key Key, val Value)

// Remove removes the specified key from the cache. If key is not present,
Expand All @@ -199,7 +199,7 @@ type Store[Key comparable, Value any] interface {
// for each item evicted, if any.
//
// If Evict cannot satisfy the specified size, it should panic.
// This should not be possible.
// That condition should not be possible.
Evict(need int64, sizeOf func(Value) int64, onEvict func(Key, Value)) int64
}

Expand Down

0 comments on commit 0b7ee7a

Please sign in to comment.