cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyNotFound     = "key not found"
	ErrorClearCache = "fail to clean cache %s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	GetHost() string
	GetPort() int
	GetUser() string
	GetPassword() string
	GetDatabase() string
}

Config Interface With Methods to be a database config

type Redis

type Redis struct {
	Client *redisClient.Client
	// contains filtered or unexported fields
}

Redis struct to manage redis.

func NewRedis

func NewRedis(config Config) (*Redis, error)

NewRedis is responsible for building a redis struct instance

func (*Redis) Close

func (r *Redis) Close()

Close is responsible for closing redis connection

func (*Redis) Connect

func (r *Redis) Connect() error

Connect connects on redis database

func (*Redis) Del

func (r *Redis) Del(key string) error

Del delete key.

func (*Redis) Exist

func (r *Redis) Exist(key string) (bool, error)

Exist test if key exists.

func (*Redis) FlushAll

func (r *Redis) FlushAll() error

FlushAll clears all keys in the cache

func (*Redis) Get

func (r *Redis) Get(key string) (string, error)

Get get key.

func (*Redis) Set

func (r *Redis) Set(key, value string, duration time.Duration) error

Set set key.

Jump to

Keyboard shortcuts

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