cache

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const MSG_CACHE_NOT_FOUND = "Cache not found"

Variables

This section is empty.

Functions

func Clear added in v0.0.2

func Clear()

Clear all keys in cache

func Count

func Count(key string, expiration time.Duration) int

Count the number of keys in cache

func Del added in v0.0.2

func Del(key string) bool

Delete a value from cache

func Get

func Get(key string, def interface{}) interface{}

Get a value from cache

func Keys added in v0.0.2

func Keys() []string

Return all keys in cache

func Len added in v0.0.2

func Len() int

Return the number of keys in cache

func Load

func Load(tp string) error

Load a new cache connection

func Set

func Set(key string, value interface{}, expiration time.Duration) interface{}

Set a value in cache

func Type added in v0.0.2

func Type() string

Return the type of cache

func Values added in v0.0.2

func Values() []interface{}

Return all values in cache

Types

type Cache added in v0.0.2

type Cache interface {
	Type() string
	Set(key string, value interface{}, expiration time.Duration) interface{}
	Get(key string, def interface{}) interface{}
	Del(key string) bool
	Count(key string, expiration time.Duration) int
	Clear()
	Len() int
	Keys() []string
	Values() []interface{}
}

type TpCahe added in v0.0.2

type TpCahe int

Type adatapter

const (
	TpRedis TpCahe = iota
	TpMem
)

func (TpCahe) String added in v0.0.2

func (tp TpCahe) String() string

Jump to

Keyboard shortcuts

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