knife

package
v1.1.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package knife 提供了 context.Context 上的缓存。

Index

Constants

This section is empty.

Variables

View Source
var ErrUninitialized = errors.New("knife uninitialized")

Functions

func Fetch

func Fetch(ctx context.Context, key string, out interface{}) (bool, error)

Fetch 从 context.Context 对象中获取 key 对应的 val。

func Get

func Get(ctx context.Context, key string) (interface{}, bool)

Get 从 context.Context 对象中获取 key 对应的 val。

func New

func New(ctx context.Context) context.Context

New 返回带有缓存空间的 context.Context 对象。

func Set

func Set(ctx context.Context, key string, val interface{}) error

Set 将 key 及其 val 保存到 context.Context 对象。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL