Skip to content

Commit

Permalink
Add ReplaceKey method (#38)
Browse files Browse the repository at this point in the history
* Add ReplaceKey method

* Extend unit tests
  • Loading branch information
erni27 committed May 2, 2023
1 parent b1f3d7b commit 8231e75
Show file tree
Hide file tree
Showing 3 changed files with 450 additions and 85 deletions.
5 changes: 5 additions & 0 deletions eviction.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const (
// limit. The least recently used entry is evicted regardless of the
// entry's expiration time.
EvictionReasonMaxEntriesExceeded
// EvictionReasonKeyReplaced indicates that the entry was evicted
// because the key was replaced.
EvictionReasonKeyReplaced
)

func (r EvictionReason) String() string {
Expand All @@ -32,6 +35,8 @@ func (r EvictionReason) String() string {
return "replaced"
case EvictionReasonMaxEntriesExceeded:
return "max entries limit exceeded"
case EvictionReasonKeyReplaced:
return "key replaced"
default:
return "unknown"
}
Expand Down

0 comments on commit 8231e75

Please sign in to comment.