MCPcopy Create free account
hub / github.com/oschwald/maxminddb-golang / stringCache

Struct stringCache

internal/decoder/string_cache.go:23–26  ·  view source on GitHub ↗

stringCache holds two parallel 4096-slot arrays indexed by offset%4096. entries holds admitted strings; recentMisses records the last missing offset seen at each slot so we can admit only on the second consecutive miss for the same offset (see internAt). The arrays are intentionally separate rather

Source from the content-addressed store, hash-verified

21// entries than from co-locating each entry with its rarely-touched miss
22// counter.
23type stringCache struct {
24 entries [4096]atomic.Pointer[cacheEntry]
25 recentMisses [4096]atomic.Uint64
26}
27
28func newStringCache() *stringCache {
29 return &stringCache{}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected