redis

package
v0.0.0-...-5270433 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

CRC16 implementation according to CCITT standards. Copyright 2001-2010 Georges Menie (www.menie.org) Copyright 2013 The Go Authors. All rights reserved. http://redis.io/topics/cluster-spec#appendix-a-crc16-reference-implementation-in-ansi-c

Index

Constants

View Source
const (
	Sentinel = "sentinel"
	Cluster  = "cluster"

	DefaultPoolSize     = 100
	DefaultReadTimeout  = 1000
	DefaultWriteTimeout = 1000
)
View Source
const SlotNumber = 16384

Variables

View Source
var (
	ErrorMissingRedisAddress = errors.New("missing redis address")
)

Functions

func GetSlotID

func GetSlotID(key string, slots []redis.ClusterSlot) string

func IsInSlot

func IsInSlot(key string, slot redis.ClusterSlot) bool

func Key

func Key(key string) string

Key -

func RandomSlot

func RandomSlot() int

RandomSlot -

func Slot

func Slot(key string) int

Slot hashSlot returns a consistent slot number between 0 and 16383 for any given string key.

Types

type Connection

type Connection interface {
	BuildClient() (redis.UniversalClient, error)
}

func NewRedisConfig

func NewRedisConfig(add string, db int) Connection

type Redis

type Redis struct {
	redis.UniversalClient
	Slots []redis.ClusterSlot
}

func NewConnection

func NewConnection(conn Connection) (*Redis, error)

func (*Redis) Close

func (br *Redis) Close() error

func (*Redis) GetClient

func (br *Redis) GetClient() redis.UniversalClient

func (*Redis) GetClusterSlots

func (br *Redis) GetClusterSlots() ([]redis.ClusterSlot, error)

func (*Redis) GetRedisSlot

func (br *Redis) GetRedisSlot(key string) int

func (*Redis) GetRedisSlotID

func (br *Redis) GetRedisSlotID(key string) string

type RedisInterface

type RedisInterface interface {
	redis.UniversalClient
	GetClient() redis.UniversalClient
	GetClusterSlots() ([]redis.ClusterSlot, error)
	GetRedisSlot(key string) int
	GetRedisSlotID(key string) string
}

type SentinelConnection

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

func (*SentinelConnection) BuildClient

func (conn *SentinelConnection) BuildClient() (redis.UniversalClient, error)

type SingleConnection

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

func (*SingleConnection) BuildClient

func (conn *SingleConnection) BuildClient() (redis.UniversalClient, error)

Jump to

Keyboard shortcuts

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