redis

package
v3.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(cfg *config.RedisConfig, dialFunc func(*config.RedisConfig, bool) func() (redis.Conn, error))

Configure redis-connection

func DefaultDialFunc

func DefaultDialFunc(cfg *config.RedisConfig, setReadTimeout bool) func() (redis.Conn, error)

DefaultDialFunc should always used. Only exception is for unit-tests.

func Get

func Get() redis.Conn

Get a connection for the Redis-pool

func GetString

func GetString(key string) (string, error)

GetString fetches the value of a key in Redis as a string

func Process

func Process()

Process redis subscriptions

NOTE: There Can Only Be One!

Types

type KeyChan

type KeyChan struct {
	Key  string
	Chan chan string
}

KeyChan holds a key and a channel

type WatchKeyStatus

type WatchKeyStatus int

WatchKeyStatus is used to tell how WatchKey returned

const (
	// WatchKeyStatusTimeout is returned when the watch timeout provided by the caller was exceeded
	WatchKeyStatusTimeout WatchKeyStatus = iota
	// WatchKeyStatusAlreadyChanged is returned when the value passed by the caller was never observed
	WatchKeyStatusAlreadyChanged
	// WatchKeyStatusSeenChange is returned when we have seen the value passed by the caller get changed
	WatchKeyStatusSeenChange
	// WatchKeyStatusNoChange is returned when the function had to return before observing a change.
	//  Also returned on errors.
	WatchKeyStatusNoChange
)

func WatchKey

func WatchKey(key, value string, timeout time.Duration) (WatchKeyStatus, error)

WatchKey waits for a key to be updated or expired

Jump to

Keyboard shortcuts

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