MCPcopy Create free account
hub / github.com/cloud-native-go/examples / init

Function init

ch07/lru/main.go:27–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25var cache *lru.Cache[int, string]
26
27func init() {
28 cache, _ = lru.NewWithEvict(2,
29 func(key int, value string) {
30 fmt.Printf("Evicted: key=%d value=%s\n", key, value)
31 },
32 )
33}
34
35func main() {
36 cache.Add(1, "a") // adds 1

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected