cache

package
v0.0.0-...-951e0d2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

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) error

Set cached value with key and expire time.

type Rediscache

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

Redis struct contains *Rediscache.Client

func NewRediscache

func NewRediscache(host string, port uint) (*Rediscache, error)

NewRediscache create new Redis

func (*Rediscache) Delete

func (res *Rediscache) Delete(key string) error

Delete delete value in Redis.

func (*Rediscache) Get

func (res *Rediscache) Get(key string) interface{}

Get return cached value

func (*Rediscache) IsExist

func (res *Rediscache) IsExist(key string) bool

IsExist check value exists in Redis.

func (*Rediscache) Set

func (res *Rediscache) Set(key string, val interface{}, timeout time.Duration) 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