redis

package
v0.0.0-...-1272ae6 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

使用方法:

1. init

func init(){
	InitRds(&RDSConfig{
		Host:"127.0.0.1",
		Port:2379,
		Password:"123456",
		MaxIdle:10,
		MaxActive:10000,
		DB:0,
	})
}

2.调用操作方法 rc:=new(RdsCommon) val,err:=rc.Get(key) .... ...

使用方法

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRDSClient

func InitRDSClient(rdc *RDSConfig) (err error)

InitRDSClient init config

Types

type RDSCommon

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

RDSCommon redis操作类

func GetRDSCommon

func GetRDSCommon() *RDSCommon

GetRDSCommon GetRDSCommon

func (*RDSCommon) AddSet

func (m *RDSCommon) AddSet(key string, values []string) error

================set======================

func (*RDSCommon) DEL

func (m *RDSCommon) DEL(key string) (int64, error)

DEL 删除某个Key

func (*RDSCommon) Exists

func (m *RDSCommon) Exists(key string) (bool, error)

Exist key是否正在

func (*RDSCommon) GETList

func (m *RDSCommon) GETList(key string) (data []string, err error)

func (*RDSCommon) GETSet

func (m *RDSCommon) GETSet(key string) (data []string, err error)

根据key 返回set

func (*RDSCommon) GetBit

func (m *RDSCommon) GetBit(key string, offset int64) (int, error)

================bit======================

func (*RDSCommon) GetHashAll

func (m *RDSCommon) GetHashAll(key string, obj interface{}) (err error)

GetHash GetHash

func (*RDSCommon) GetHashInt

func (m *RDSCommon) GetHashInt(key string, v interface{}) (int64, error)

GetHashInt 获取hash里某个int值

func (*RDSCommon) GetHashString

func (m *RDSCommon) GetHashString(key string, v interface{}) (string, error)

GetHashString 获取hash里某个int值

func (*RDSCommon) GetInt64

func (m *RDSCommon) GetInt64(key string) (v int64, err error)

GetInt64 取 int64

func (*RDSCommon) GetString

func (m *RDSCommon) GetString(key string) (v string, err error)

GetString 取 string

func (*RDSCommon) GetTTL

func (m *RDSCommon) GetTTL(key string) (ttl int64, err error)

GetTTL 获取某个key的过期(剩余时间)

func (*RDSCommon) HashFieldExists

func (m *RDSCommon) HashFieldExists(key, field string) (bool, error)

HashFieldExists hash某个field是否存在

func (*RDSCommon) Lock

func (m *RDSCommon) Lock(key string, timeout int) (flag bool, err error)

Lock Lock key timeout期时间

func (*RDSCommon) ReName

func (m *RDSCommon) ReName(dist, newKey string) (err error)

ReName

func (*RDSCommon) SETList

func (m *RDSCommon) SETList(key string, values []string) error

================list======================

func (*RDSCommon) SetBit

func (m *RDSCommon) SetBit(key string, offset int64, v int) (err error)

SetBit

func (*RDSCommon) SetEXPIRE

func (m *RDSCommon) SetEXPIRE(key string, seconds int64) (bool, error)

SetEXPIRE 设置过期时间

func (*RDSCommon) SetEXPIREAT

func (m *RDSCommon) SetEXPIREAT(key string, timestamp int64) (bool, error)

SetEXPIREAT 设置过期时间(以时间戳的方式)

func (*RDSCommon) SetEx

func (m *RDSCommon) SetEx(key string, v interface{}, ex int64) (ok bool, err error)

SetEx 写入string,同时设置过期时间 ex为过期时间

func (*RDSCommon) SetHash

func (m *RDSCommon) SetHash(key string, v interface{}) (err error)

SetHash设置 hash值

func (*RDSCommon) SetHashField

func (m *RDSCommon) SetHashField(key string, field, v interface{}) (int64, error)

SetHashField 设置某个field值

func (*RDSCommon) SetString

func (m *RDSCommon) SetString(key string, v interface{}) (ok bool, err error)

SetString 设置值

func (*RDSCommon) UnLock

func (m *RDSCommon) UnLock(key string) (err error)

UnLock UnLock

func (*RDSCommon) ZSets

func (m *RDSCommon) ZSets(key string, mp map[float64]interface{}) (err error)

================zset======================

type RDSConfig

type RDSConfig struct {
	Host      string
	Port      int
	Password  string
	MaxIdle   int
	MaxActive int
	DB        int
}

RDSConfig RDSConfig

Jump to

Keyboard shortcuts

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