driver

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Redis

type Redis struct {
	sync.RWMutex
	Client   *redis.Client
	Addr     string
	Password string
	DB       int
}

Redis driver

func NewRedisDriver

func NewRedisDriver() *Redis

NewRedisDriver create a new instance

func (*Redis) Connect

func (r *Redis) Connect() (bool, error)

Connect establish a redis connection

func (*Redis) Del

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

Del deletes a record

func (*Redis) Exists

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

Exists deletes a record

func (*Redis) Get

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

Get gets a record value

func (*Redis) HDel

func (r *Redis) HDel(key, field string) (int64, error)

HDel deletes a hash record

func (*Redis) HExists

func (r *Redis) HExists(key, field string) (bool, error)

HExists checks if key exists on a hash

func (*Redis) HGet

func (r *Redis) HGet(key, field string) (string, error)

HGet gets a record from hash

func (*Redis) HLen

func (r *Redis) HLen(key string) (int64, error)

HLen count hash records

func (*Redis) HScan

func (r *Redis) HScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd

HScan return an iterative obj for a hash

func (*Redis) HSet

func (r *Redis) HSet(key, field, value string) (bool, error)

HSet sets a record in hash

func (*Redis) HTruncate

func (r *Redis) HTruncate(key string) (int64, error)

HTruncate deletes a hash

func (*Redis) Ping

func (r *Redis) Ping() (bool, error)

Ping checks the redis connection

func (*Redis) Set

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

Set sets a record

Jump to

Keyboard shortcuts

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