redis

package
v0.0.0-...-9fb4324 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisCacheService

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

RedisCacheService redis service define

func (*RedisCacheService) Del

func (service *RedisCacheService) Del(key string) error

func (*RedisCacheService) Dels

func (service *RedisCacheService) Dels(keys []string) error

func (*RedisCacheService) Exists

func (service *RedisCacheService) Exists(key string) (bool, error)

func (*RedisCacheService) Get

func (service *RedisCacheService) Get(key string) ([]byte, error)

func (*RedisCacheService) HDel

func (service *RedisCacheService) HDel(key string, fields ...[]byte) (int64, error)

func (*RedisCacheService) HExists

func (service *RedisCacheService) HExists(key string, field []byte) (bool, error)

func (*RedisCacheService) HGet

func (service *RedisCacheService) HGet(key string, field []byte) ([]byte, error)

func (*RedisCacheService) HGetAll

func (service *RedisCacheService) HGetAll(key string) ([][]byte, error)

func (*RedisCacheService) HKeys

func (service *RedisCacheService) HKeys(key string) ([][]byte, error)

func (*RedisCacheService) HLen

func (service *RedisCacheService) HLen(key string) (int64, error)

func (*RedisCacheService) HMGet

func (service *RedisCacheService) HMGet(key string, fields ...[]byte) ([][]byte, error)

func (*RedisCacheService) HMSet

func (service *RedisCacheService) HMSet(key string, ttl int64, args ...[]byte) error

func (*RedisCacheService) HSet

func (service *RedisCacheService) HSet(key string, ttl int64, field string, value []byte) error

-----------------hash operation-------------------

func (*RedisCacheService) HVals

func (service *RedisCacheService) HVals(key string) ([][]byte, error)

func (*RedisCacheService) Initialize

func (service *RedisCacheService) Initialize(redisCfg interface{}, l log.Logger)

Initialize redis service init

func (*RedisCacheService) Keys

func (service *RedisCacheService) Keys(keyFormat string) ([][]byte, error)

func (*RedisCacheService) LIndex

func (service *RedisCacheService) LIndex(key string, index int64) ([]byte, error)

func (*RedisCacheService) LLpop

func (service *RedisCacheService) LLpop(key string) ([]byte, error)

func (*RedisCacheService) LLpush

func (service *RedisCacheService) LLpush(key string, args ...[]byte) (int64, error)

func (*RedisCacheService) LRpop

func (service *RedisCacheService) LRpop(key string) ([]byte, error)

func (*RedisCacheService) LRpush

func (service *RedisCacheService) LRpush(key string, args ...[]byte) (int64, error)

-----------------list operation--------------------

func (*RedisCacheService) Mget

func (service *RedisCacheService) Mget(keys []string) ([][]byte, error)

func (*RedisCacheService) Mset

func (service *RedisCacheService) Mset(keyvalues [][2][]byte, ttl int64) error

func (*RedisCacheService) SAdd

func (service *RedisCacheService) SAdd(key string, ttl int64, members ...[]byte) error

-----------------set operation---------------------

func (*RedisCacheService) SCard

func (service *RedisCacheService) SCard(key string) (int64, error)

func (*RedisCacheService) SIsMember

func (service *RedisCacheService) SIsMember(key string, member []byte) (bool, error)

func (*RedisCacheService) SMembers

func (service *RedisCacheService) SMembers(key string) ([][]byte, error)

func (*RedisCacheService) SRem

func (service *RedisCacheService) SRem(key string, members ...[]byte) (int64, error)

func (*RedisCacheService) Set

func (service *RedisCacheService) Set(key string, value []byte, ttl int64) error

-----------------string operation------------------ when set exist key, old key ttl must reset it

func (*RedisCacheService) Start

func (service *RedisCacheService) Start()

Start xx

func (*RedisCacheService) Stop

func (service *RedisCacheService) Stop()

Stop xx

func (*RedisCacheService) ZAdd

func (service *RedisCacheService) ZAdd(key string, ttl int64, args ...[]byte) error

-----------------zset operation-------------------

func (*RedisCacheService) ZCard

func (service *RedisCacheService) ZCard(key string) (int64, error)

func (*RedisCacheService) ZRange

func (service *RedisCacheService) ZRange(key string, start, stop int64, withScores bool) ([][]byte, error)

func (*RedisCacheService) ZRangeByScore

func (service *RedisCacheService) ZRangeByScore(key string, min, max interface{}, withScores bool) ([][]byte, error)

func (*RedisCacheService) ZRank

func (service *RedisCacheService) ZRank(key string, member []byte) (int64, error)

func (*RedisCacheService) ZRem

func (service *RedisCacheService) ZRem(key string, args ...[]byte) (int64, error)

func (*RedisCacheService) ZRemRangeByScore

func (service *RedisCacheService) ZRemRangeByScore(key string, start, stop int64) (int64, error)

func (*RedisCacheService) ZRevRange

func (service *RedisCacheService) ZRevRange(key string, start, stop int64, withScores bool) ([][]byte, error)

func (*RedisCacheService) ZRevRank

func (service *RedisCacheService) ZRevRank(key string, member []byte) (int64, error)

type RedisOptions

type RedisOptions struct {
	Host        string
	Port        string
	Password    string
	IdleTimeout int
	MaxIdle     int
	MaxActive   int
}

type Service

type Service interface {
	// string
	Set(key string, value []byte, ttl int64) error
	Get(key string) ([]byte, error)
	Mset(keyvalues [][2][]byte, ttl int64) error
	Mget(keys []string) ([][]byte, error)
	Exists(key string) (bool, error)
	Del(key string) error
	Dels(keys []string) error
	Keys(keyFormat string) ([][]byte, error)

	// set
	SAdd(key string, ttl int64, members ...[]byte) error
	SRem(key string, members ...[]byte) (int64, error)
	SCard(key string) (int64, error)
	SIsMember(key string, member []byte) (bool, error)
	SMembers(key string) ([][]byte, error)

	// zset
	ZAdd(key string, ttl int64, args ...[]byte) error
	ZRem(key string, args ...[]byte) (int64, error)
	ZCard(key string) (int64, error)
	ZRank(key string, member []byte) (int64, error)
	ZRevRank(key string, member []byte) (int64, error)
	ZRange(key string, start, stop int64, withScores bool) ([][]byte, error)
	ZRangeByScore(key string, min, max interface{}, withScores bool) ([][]byte, error)
	ZRevRange(key string, start, stop int64, withScores bool) ([][]byte, error)

	// hash
	HSet(key string, ttl int64, field string, value []byte) error
	HGet(key string, field []byte) ([]byte, error)
	HMSet(key string, ttl int64, args ...[]byte) error
	HMGet(key string, fields ...[]byte) ([][]byte, error)
	HDel(key string, fields ...[]byte) (int64, error)
	HExists(key string, field []byte) (bool, error)
	HKeys(key string) ([][]byte, error)
	HVals(key string) ([][]byte, error)
	HGetAll(key string) ([][]byte, error)
	HLen(key string) (int64, error)

	// list
	LRpush(key string, args ...[]byte) (int64, error)
	LLpush(key string, args ...[]byte) (int64, error)
	LRpop(key string) ([]byte, error)
	LLpop(key string) ([]byte, error)
	LIndex(key string, index int64) ([]byte, error)
}

Service implement interface for redis servece

Jump to

Keyboard shortcuts

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