32
33
// Close closes the iterator
34
>
func (it *simpleItr) Close() {
simple.go
35
>
it.simple.RUnlock()
36
>
}
37
38
// HasNext return true if there is more items to be returned
39
>
func (it *simpleItr) HasNext() bool {
simple.go
40
>
return it.nextItem != nil
41
>
}
42
43
// Next returns the next item
44
>
func (it *simpleItr) Next() Entry {
simple.go
45
>
if it.nextItem == nil {
46
panic("Simple cache iterator Next called when there is no next item")
47
}
48
49
// nolint:revive
50
>
entry := it.nextItem.Value.(*simpleEntry)
simple.go
51
>
it.nextItem = it.nextItem.Next()
52
>
// make a copy of the entry so there will be no concurrent access to this entry
53
>
entry = &simpleEntry{
54
>
key: entry.key,
55
>
value: entry.value,
56
>
}
57
>
return entry
58
}
59