Skip to content

Commit c8f7ec8

Browse files
committed
chore: renamed SetOnEvict func to SetOnEvicted
1 parent 70c5735 commit c8f7ec8

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

s3fifo/s3fifo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func (s *S3FIFO[K, V]) Peek(key K) (value V, ok bool) {
179179
return el.value, ok
180180
}
181181

182-
func (s *S3FIFO[K, V]) SetOnEvict(callback types.OnEvictCallback[K, V]) {
182+
func (s *S3FIFO[K, V]) SetOnEvicted(callback types.OnEvictCallback[K, V]) {
183183
s.mu.Lock()
184184
defer s.mu.Unlock()
185185

s3fifo/s3fifo_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func TestEvictionCallback(t *testing.T) {
192192
cache := New[int, int](10, noEvictionTTL)
193193
evicted := make(map[int]int)
194194

195-
cache.SetOnEvict(func(key int, value int) {
195+
cache.SetOnEvicted(func(key int, value int) {
196196
evicted[key] = value
197197
})
198198

@@ -216,7 +216,7 @@ func TestEvictionCallbackWithTTL(t *testing.T) {
216216
var mu sync.Mutex
217217
cache := New[int, int](10, time.Second)
218218
evicted := make(map[int]int)
219-
cache.SetOnEvict(func(key int, value int) {
219+
cache.SetOnEvicted(func(key int, value int) {
220220
mu.Lock()
221221
evicted[key] = value
222222
mu.Unlock()

sieve/sieve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func (s *Sieve[K, V]) Peek(key K) (value V, ok bool) {
164164
return
165165
}
166166

167-
func (s *Sieve[K, V]) SetOnEvict(callback types.OnEvictCallback[K, V]) {
167+
func (s *Sieve[K, V]) SetOnEvicted(callback types.OnEvictCallback[K, V]) {
168168
s.mu.Lock()
169169
defer s.mu.Unlock()
170170

sieve/sieve_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func TestEvictionCallback(t *testing.T) {
146146
cache := New[int, int](10, noEvictionTTL)
147147
evicted := make(map[int]int)
148148

149-
cache.SetOnEvict(func(key int, value int) {
149+
cache.SetOnEvicted(func(key int, value int) {
150150
evicted[key] = value
151151
})
152152

@@ -170,7 +170,7 @@ func TestEvictionCallbackWithTTL(t *testing.T) {
170170
var mu sync.Mutex
171171
cache := New[int, int](10, time.Second)
172172
evicted := make(map[int]int)
173-
cache.SetOnEvict(func(key int, value int) {
173+
cache.SetOnEvicted(func(key int, value int) {
174174
mu.Lock()
175175
evicted[key] = value
176176
mu.Unlock()

types/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ type Cache[K comparable, V any] interface {
1919
// Peek returns key's value without updating the recent-ness.
2020
Peek(key K) (value V, ok bool)
2121

22-
// SetOnEvict sets the callback function that will be called when an entry is evicted from the cache.
23-
SetOnEvict(callback OnEvictCallback[K, V])
22+
// SetOnEvicted sets the callback function that will be called when an entry is evicted from the cache.
23+
SetOnEvicted(callback OnEvictCallback[K, V])
2424

2525
// Len returns the number of entries in the cache.
2626
Len() int

0 commit comments

Comments
 (0)