cache

package
v0.0.0-...-cdf81b2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2019 License: Apache-2.0 Imports: 5 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 Redis

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

func NewRedis

func NewRedis(rediscon, redispass string) *Redis

func (*Redis) Delete

func (c *Redis) Delete(key string) error

func (*Redis) Get

func (c *Redis) Get(key string) interface{}

func (*Redis) IsExist

func (c *Redis) IsExist(key string) bool

func (*Redis) Set

func (c *Redis) Set(key string, val interface{}, timeout time.Duration) error

Jump to

Keyboard shortcuts

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