redis

package
v1.3.3-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Reference: https://github.com/astaxie/goredis

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(conn net.Conn, timeout time.Duration) (c *Client)

func (*Client) Auth

func (client *Client) Auth(password string) error

General Commands

func (*Client) Close

func (client *Client) Close() error

func (*Client) Do

func (client *Client) Do(cmd string, args ...string) (interface{}, error)

func (*Client) Get

func (client *Client) Get(key string) ([]byte, error)

func (*Client) GetEx

func (client *Client) GetEx(key string, timeout time.Duration) ([]byte, error)

func (*Client) Publish

func (client *Client) Publish(channel, val string) error

Publish a message to a redis server.

func (*Client) Set

func (client *Client) Set(key, val string) error

String-related commands

func (*Client) SetEx

func (client *Client) SetEx(key, val string, timeout time.Duration) error

func (*Client) Subscribe

func (client *Client) Subscribe(subscribe <-chan string, unsubscribe <-chan string, psubscribe <-chan string, punsubscribe <-chan string, messages chan<- Message) error

Subscribe to redis serve channels, this method will block until one of the sub/unsub channels are closed. There are two pairs of channels subscribe/unsubscribe & psubscribe/punsubscribe. The former does an exact match on the channel, the later uses glob patterns on the redis channels. Closing either of these channels will unblock this method call. Messages that are received are sent down the messages channel.

func (*Client) Ttl

func (client *Client) Ttl(key string) (int64, error)

type Message

type Message struct {
	ChannelMatched string
	Channel        string
	Message        []byte
}

Container for messages received from publishers on channels that we're subscribed to.

type RedisError

type RedisError string

func (RedisError) Error

func (err RedisError) Error() string

Jump to

Keyboard shortcuts

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