cache

package
v0.0.0-...-8fa8669 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(key string) interface{}
	Set(key string, val interface{}, timeout time.Duration) error
	IsExist(key string) bool
	Delete(key string) error
}

Cache interface

type Memcache

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

Memcache struct contains *memcache.Client

func NewMemcache

func NewMemcache(server ...string) *Memcache

NewMemcache create new memcache

func (*Memcache) Delete

func (mem *Memcache) Delete(key string) error

Delete delete value in memcache.

func (*Memcache) Get

func (mem *Memcache) Get(key string) interface{}

Get return cached value

func (*Memcache) IsExist

func (mem *Memcache) IsExist(key string) bool

IsExist check value exists in memcache.

func (*Memcache) Set

func (mem *Memcache) Set(key string, val interface{}, timeout time.Duration) (err error)

Set cached value with key and expire time.

Jump to

Keyboard shortcuts

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