Skip to content

Commit 2f7ea33

Browse files
committed
simplifies name of Entry struct.
1 parent ac89cca commit 2f7ea33

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

s3fifo/s3fifo.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/scalalang2/golang-fifo"
88
)
99

10-
type s3fifoEntry[V any] struct {
10+
type entry[V any] struct {
1111
value V
1212
freq byte
1313
}
@@ -19,7 +19,7 @@ type S3FIFO[K comparable, V any] struct {
1919
size int
2020

2121
// followings are the fundamental data structures of S3FIFO algorithm.
22-
items map[K]*s3fifoEntry[V]
22+
items map[K]*entry[V]
2323
small *ringBuf[K]
2424
main *ringBuf[K]
2525
ghost *bucketTable[K]
@@ -28,7 +28,7 @@ type S3FIFO[K comparable, V any] struct {
2828
func New[K comparable, V any](size int) fifo.Cache[K, V] {
2929
return &S3FIFO[K, V]{
3030
size: size,
31-
items: make(map[K]*s3fifoEntry[V]),
31+
items: make(map[K]*entry[V]),
3232
small: newRingBuf[K](size),
3333
main: newRingBuf[K](size),
3434
ghost: newBucketTable[K](size),
@@ -60,7 +60,7 @@ func (s *S3FIFO[K, V]) Set(key K, value V) {
6060
}
6161
}
6262

63-
ent := &s3fifoEntry[V]{value: value, freq: 0}
63+
ent := &entry[V]{value: value, freq: 0}
6464
s.items[key] = ent
6565
}
6666

@@ -106,7 +106,7 @@ func (s *S3FIFO[K, V]) Clean() {
106106
s.lock.Lock()
107107
defer s.lock.Unlock()
108108

109-
s.items = make(map[K]*s3fifoEntry[V])
109+
s.items = make(map[K]*entry[V])
110110
s.small = newRingBuf[K](s.size)
111111
s.main = newRingBuf[K](s.size)
112112
s.ghost = newBucketTable[K](s.size)

sieve/sieve.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/scalalang2/golang-fifo"
88
)
99

10+
// entry holds the key and value of a cache entry.
1011
type entry[K comparable, V any] struct {
1112
key K
1213
value V

0 commit comments

Comments
 (0)