coreredis

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

README

Core Redis

This package is used to wrap redis to satisfy the health checking server in the LUSH core service library

Examples

Use in conjunction with readysrv
client := redis.NewDefaultClient()
readysrv.New(readysrv.Checks{
    "redis": client,
})

Documentation

Index

Constants

View Source
const (
	// DefaultURL is the default redis host url.
	DefaultURL = "redis://127.0.0.1:6379/0"
)

Variables

This section is empty.

Functions

func Parse

func Parse(s string) (*redis.Options, error)

Parse attempts to parse a redis url and return options.

func URLFromEnv

func URLFromEnv() string

URLFromEnv tries to retrieve the redis url from the environment.

Types

type Client

type Client struct {
	*redis.Client
}

Client represents a wrapped redis client.

func NewClient

func NewClient(opt *redis.Options) *Client

NewClient returns a wrapped redis client.

func NewDefaultClient

func NewDefaultClient() *Client

NewDefaultClient returns a wrapped redis client with default configuration.

func (*Client) Check

func (c *Client) Check() ([]string, bool)

Check returns information about the connection to the redis server.

type ConfigError

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

ConfigError happens when the redis connection cannot be configured.

func (ConfigError) Error

func (e ConfigError) Error() string

type GobClient

type GobClient struct {
	*Client
}

GobClient represents a wrapped redis client for Gob operations.

func NewGobClient

func NewGobClient(c *Client) *GobClient

NewGobClient returns a redis client wrapper for Gob operations.

func (*GobClient) GetGob

func (c *GobClient) GetGob(key string, v interface{}) error

GetGob will get try and get byte data from a key in redis and gob unmarshal to the provided container.

func (*GobClient) SetGob

func (c *GobClient) SetGob(key string, v interface{}, expiration time.Duration) error

SetGob will take the value and gob marshal it to bytes and store in redis.

Jump to

Keyboard shortcuts

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