cache

package
v0.0.0-...-60deb49 Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package cache defines and implement the cache layer, especially for redis

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCacheKey

func GetCacheKey(namespace string, name string) (string, error)

Types

type HTTP

type HTTP struct {
	StatusCode int    `json:"code"`
	Response   []byte `json:"response"`
}

type Rediser

type Rediser interface {
	Set(ctx context.Context, key string, value interface{}, ttl time.Duration) *redis.StatusCmd
	SetXX(ctx context.Context, key string, value interface{}, ttl time.Duration) *redis.BoolCmd
	SetNX(ctx context.Context, key string, value interface{}, ttl time.Duration) *redis.BoolCmd

	Get(ctx context.Context, key string) *redis.StringCmd
	Del(ctx context.Context, keys ...string) *redis.IntCmd
}

func NewRedis

func NewRedis(c config.Conf) (rdb Rediser, err error)

func NewReplicaRedisService

func NewReplicaRedisService(MasterAddrs []config.RedisAddress, SlaveAddrs []config.RedisAddress, Password string) (Rediser, error)

Jump to

Keyboard shortcuts

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