package
1.1.3
Repository: https://github.com/go-spring/spring-base.git
Documentation: pkg.go.dev

# README

knife

Provides cache on context.Context.

Install

go get github.com/go-spring/[email protected] 

Import

import "github.com/go-spring/spring-base/knife"

Example

ctx = knife.New(context.Background())
err = knife.Store(ctx, "a", "b")
v, err := knife.Load(ctx, "a")
v, err = knife.LoadOrStore(ctx, "a", "b")

# Functions

Delete deletes the key and value.
Load returns the value stored for a key, or nil if no value is present.
LoadOrStore returns the existing value for the key if present.
New returns a new context.Context with a *sync.Map bound.
Range calls f sequentially for each key and value.
Store stores the key and value in the context.Context, if the key is already in the context.Context, the error of duplicate key will be returned.