redis

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const GlobalKeyPrefix = "distributed-cron:"

GlobalKeyPrefix is global redis key preifx

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Proto string

	// first use addr
	Addr     string
	Password string

	Host string
	Port int

	MaxActive   int
	MaxIdle     int
	IdleTimeout time.Duration
	Wait        bool
}

RedisConf is redis config

type RedisDriver

type RedisDriver struct {
	Key string
	// contains filtered or unexported fields
}

RedisDriver is redisDriver

func NewDriver

func NewDriver(conf *Conf, options ...redis.DialOption) (*RedisDriver, error)

NewDriver return a redis driver

func (*RedisDriver) GetServiceNodeList

func (rd *RedisDriver) GetServiceNodeList(serviceName string) ([]string, error)

GetServiceNodeList get a serveice node list

func (*RedisDriver) Ping

func (rd *RedisDriver) Ping() error

Ping is check redis valid

func (*RedisDriver) RegisterServiceNode

func (rd *RedisDriver) RegisterServiceNode(serviceName string) (nodeID string)

RegisterServiceNode register a service node

func (*RedisDriver) SetHeartBeat

func (rd *RedisDriver) SetHeartBeat(nodeID string)

SetHeartBeat set herbear

func (*RedisDriver) SetTimeout

func (rd *RedisDriver) SetTimeout(timeout time.Duration)

SetTimeout set redis timeout

Jump to

Keyboard shortcuts

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