cache

package
v0.0.0-...-d340b99 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoginKey = "login:%s"
)

常量

Variables

This section is empty.

Functions

func GetLoginKey

func GetLoginKey(token string) string

GetLoginKey 获取登录key

Types

type Cache

type Cache interface {
	// Get 获取一个缓存
	Get(key string) (val string, exist bool)
	// Set 设置一个值
	Set(key, val string, expiration time.Duration)
	// Del 删除知道keys
	Del(key ...string) (err error)
}

Cache 缓存接口 - 用户缓存登录信息

var (
	// DefaultMemCache 默认缓存对象
	DefaultMemCache Cache
)

type MemCache

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

MemCache 内存缓存 https://github.com/patrickmn/go-cache

func (*MemCache) Del

func (mem *MemCache) Del(key ...string) (err error)

Del 删除知道keys

func (*MemCache) Get

func (mem *MemCache) Get(key string) (val string, exist bool)

Get 获取一个缓存

func (*MemCache) Set

func (mem *MemCache) Set(key, val string, expiration time.Duration)

Set 设置一个值

Jump to

Keyboard shortcuts

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