github.com/gogf/gf@v1.16.9/.example/os/gcache/note_interface_key.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/gogf/gf/os/gcache"
     6  	"github.com/gogf/gf/os/gctx"
     7  )
     8  
     9  func main() {
    10  	var (
    11  		ctx           = gctx.New()
    12  		key1  int32   = 1
    13  		key2  float64 = 1
    14  		value         = `value`
    15  	)
    16  	_ = gcache.Ctx(ctx).Set(key1, value, 0)
    17  	fmt.Println(gcache.Ctx(ctx).Get(key1))
    18  	fmt.Println(gcache.Ctx(ctx).Get(key2))
    19  }