apcu

package
v1.1.0-alpha Latest Latest
Warning

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

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

Documentation

Overview

Package apcu 是进程内缓存,是 PHP APCu 的功能迁移。

Index

Constants

This section is empty.

Variables

View Source
var OnLoad func(key string, val interface{})

OnLoad Load 成功获取到 key 对应的缓存值时发一个通知出来。

Functions

func Delete

func Delete(key string)

Delete 删除 key 对应的缓存内容。

func Load

func Load(key string, out interface{}) (ok bool, err error)

Load 获取 key 对应的缓存值,支持存入 string 但是按照 json 反序列化后的对象取出。

func Store

func Store(key string, val interface{}, opts ...StoreOption)

Store 保存 key 及其对应的 val,支持对 key 设置 ttl 即过期时间。

Types

type StoreArg

type StoreArg struct {
	// contains filtered or unexported fields
}

type StoreOption

type StoreOption func(arg *StoreArg)

func TTL

func TTL(ttl time.Duration) StoreOption

TTL 过期时间

Jump to

Keyboard shortcuts

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