redis

package module
v0.0.0-...-702b320 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 8 Imported by: 0

README

redis-util

How to test?

docker run --rm -p 6379:6379 -d redis:latest redis-server --requirepass redis-util-pass-000

Documentation

Index

Constants

View Source
const EncoderGOB = "gob"

EncoderGOB gob encoder

View Source
const EncoderJSON = "json"

EncoderJSON json encoder

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Client *redis.Client
}

Client struct

func New

func New(conf *redis.Options) *Client

New a client

func (*Client) GetObject

func (receiver *Client) GetObject(key string, value interface{}, opts ...Option) error

func (*Client) SaveObject

func (receiver *Client) SaveObject(key string, value interface{}, opts ...Option) error

type Option

type Option struct {
	ExpireDuration *time.Duration
	Encoder        *string // JSON, GOB
}

Option struct

func WithDefaultEncoder

func WithDefaultEncoder() Option

WithDefaultEncoder with default encoder

func WithExpireTime

func WithExpireTime(duration time.Duration) Option

WithExpireTime with expire time

func WithGOBEncoder

func WithGOBEncoder() Option

WithGOBEncoder with gob encoder

func WithJSONEncoder

func WithJSONEncoder() Option

WithJSONEncoder with json encoder

Jump to

Keyboard shortcuts

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