Debian Codegraph @

examples/autoloading/autoloading_cache.go

raw symbols SCIP
1 package main
2
3 import (
4 "fmt"
5 "github.com/bluele/gcache"
6 )
7
8 func main() {
9 gc := gcache.New(10).
10 LFU().
11 LoaderFunc(func(key interface{}) (interface{}, error) {
12 return fmt.Sprintf("%v-value", key), nil
13 }).
14 Build()
15
16 v, err := gc.Get("key")
17 if err != nil {
18 panic(err)
19 }
20 fmt.Println(v)
21 }