MCPcopy
hub / github.com/coocood/freecache / Next

Method Next

iterator.go:25–36  ·  view source on GitHub ↗

Next returns the next entry for the iterator. The order of the entries is not guaranteed. If there is no more entries to return, nil will be returned.

()

Source from the content-addressed store, hash-verified

23// The order of the entries is not guaranteed.
24// If there is no more entries to return, nil will be returned.
25func (it *Iterator) Next() *Entry {
26 for it.segmentIdx < 256 {
27 entry := it.nextForSegment(it.segmentIdx)
28 if entry != nil {
29 return entry
30 }
31 it.segmentIdx++
32 it.slotIdx = 0
33 it.entryIdx = 0
34 }
35 return nil
36}
37
38func (it *Iterator) nextForSegment(segIdx int) *Entry {
39 it.cache.locks[segIdx].Lock()

Calls 1

nextForSegmentMethod · 0.95