caches

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NumInstance is number of instance
	NumInstance = 5
	// PurgeExpiredTime is time to purge cache
	PurgeExpiredTime = 10
)
View Source
const (
	// RedisMaxRetry is max retry count
	RedisMaxRetry = 3
	// RedisConnectionRandmax is using generate connection key
	RedisConnectionRandmax = 10000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheInstance

type CacheInstance interface {
	Set(key string, value interface{}, expired time.Duration) error
	Get(key string) (interface{}, bool)
	Del(key string) error
	DelBulk(key string) error
	CloseConnect() error
}

CacheInstance interface

type GoCacheClient

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

GoCacheClient struct

func NewGoCacheClient

func NewGoCacheClient(ctx context.Context) *GoCacheClient

NewGoCacheClient creates a new GoCacheClient

func (*GoCacheClient) CloseConnect

func (cc *GoCacheClient) CloseConnect() error

CloseConnect close connection

func (*GoCacheClient) Del

func (cc *GoCacheClient) Del(key string) error

Del deletes from cache

func (*GoCacheClient) DelBulk

func (cc *GoCacheClient) DelBulk(key string) error

DelBulk bulk deletes from cache

func (*GoCacheClient) Get

func (cc *GoCacheClient) Get(key string) (interface{}, bool)

Get gets from cache

func (*GoCacheClient) Set

func (cc *GoCacheClient) Set(key string, value interface{}, ttl time.Duration) error

Set puts to cache

type RedisInstance

type RedisInstance struct {
	ConnectionPersistent bool
	// contains filtered or unexported fields
}

RedisInstance struct

func NewRedis

func NewRedis(ctx context.Context, connectionpersistent bool, redisdb int) *RedisInstance

NewRedis creates a new RedisInstance

func (RedisInstance) CloseConnect

func (i RedisInstance) CloseConnect() error

CloseConnect close connection

func (RedisInstance) Del

func (i RedisInstance) Del(key string) error

Del deletes from cache

func (RedisInstance) DelBulk

func (i RedisInstance) DelBulk(key string) error

DelBulk bulk deletes from cache

func (RedisInstance) Get

func (i RedisInstance) Get(key string) (interface{}, bool)

Get gets from cache

func (RedisInstance) Set

func (i RedisInstance) Set(key string, value interface{}, expired time.Duration) error

Set puts to cache

Jump to

Keyboard shortcuts

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