Skip to content

Commit b8db083

Browse files
committed
Use the renamed ringlist package
1 parent 763d3d3 commit b8db083

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ module github.com/mgnsk/evcache/v3
33
go 1.19
44

55
require (
6-
github.com/mgnsk/list v0.0.0-20230905211842-36eaa80d0e17
7-
github.com/onsi/gomega v1.27.10
6+
github.com/mgnsk/ringlist v0.0.0-20231016175938-072bd9da3594
7+
github.com/onsi/gomega v1.28.0
88
)
99

1010
require (

go.sum

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
88
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
99
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
1010
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
11-
github.com/mgnsk/list v0.0.0-20230905211842-36eaa80d0e17 h1:wbj6xVmYBWNsWGSIa83XBA2zTooHaBcECk5DSAsS3Vo=
12-
github.com/mgnsk/list v0.0.0-20230905211842-36eaa80d0e17/go.mod h1:NSeUCVwmqTJGeKJW1DFe0En63T065/tLyj5HPwwBZd0=
13-
github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU=
14-
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
15-
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
11+
github.com/mgnsk/ringlist v0.0.0-20231016175938-072bd9da3594 h1:jUaUheJ+LrYgnsp2oBz1wIJcIJk8aQtZLWIHbSlq754=
12+
github.com/mgnsk/ringlist v0.0.0-20231016175938-072bd9da3594/go.mod h1:bVpxwIf/UWlX72d9usjtuZoNRgFLdTL7iABnOpEZubk=
13+
github.com/onsi/ginkgo/v2 v2.12.0 h1:UIVDowFPwpg6yMUpPjGkYvf06K3RAiJXUhCxEwQVHRI=
14+
github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c=
15+
github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8=
1616
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
1717
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
1818
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=

internal/backend/backend.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"sync/atomic"
99
"time"
1010

11-
"github.com/mgnsk/list"
11+
"github.com/mgnsk/ringlist"
1212
)
1313

1414
// If cap is 0, map hits this size and then shrinks by half, it is reallocated.
@@ -31,7 +31,7 @@ func (r *record[V]) Wait() {
3131
}
3232

3333
// Element is the cache element.
34-
type Element[V any] *list.Element[record[V]]
34+
type Element[V any] *ringlist.Element[record[V]]
3535

3636
// RecordMap is the cache's element map.
3737
type RecordMap[K comparable, V any] map[K]Element[V]
@@ -41,7 +41,7 @@ type Backend[K comparable, V any] struct {
4141
timer *time.Timer
4242
done chan struct{}
4343
xmap RecordMap[K, V]
44-
list list.List[record[V]]
44+
list ringlist.List[record[V]]
4545
pool sync.Pool
4646
earliestExpireAt int64
4747
cap int
@@ -82,7 +82,7 @@ func (b *Backend[K, V]) Len() int {
8282
func (b *Backend[K, V]) Reserve() Element[V] {
8383
elem, ok := b.pool.Get().(Element[V])
8484
if !ok {
85-
elem = list.NewElement(record[V]{value: *new(V)})
85+
elem = ringlist.NewElement(record[V]{value: *new(V)})
8686
}
8787

8888
elem.Value.wg.Add(1)

0 commit comments

Comments
 (0)