memcache

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B = 1 << (iota * 10)
	KB
	MB
	GB
	TB
)

Variables

This section is empty.

Functions

func GetValueSize

func GetValueSize(val interface{}) int64

func ParseSize

func ParseSize(size string) (int64, string)

Types

type MemCache

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

func NewMemCache

func NewMemCache() *MemCache

func (*MemCache) Del

func (mc *MemCache) Del(key string) bool

func (*MemCache) Exists

func (mc *MemCache) Exists(key string) bool

Exists 判断key是否存在

func (*MemCache) Flush

func (mc *MemCache) Flush() bool

Flush 清空

func (*MemCache) Get

func (mc *MemCache) Get(key string) (interface{}, bool)

func (*MemCache) Keys

func (mc *MemCache) Keys() int64

Keys 获取缓存中所有keys的数量

func (*MemCache) Set

func (mc *MemCache) Set(key string, val interface{}, expire time.Duration) bool

func (*MemCache) SetMaxMemory

func (mc *MemCache) SetMaxMemory(size string) bool

SetMaxMemory size 1KB 100KB 1MB 2MB 1GB

Jump to

Keyboard shortcuts

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