Documentation
¶
Index ¶
- type Client
- func (r *Client) BLPop(timeout time.Duration, keys ...string) ([]string, error)
- func (r *Client) BRPop(timeout time.Duration, keys ...string) ([]string, error)
- func (r *Client) Clear() error
- func (r *Client) Del(keys ...string) (int64, error)
- func (r *Client) Get(key string) (string, error)
- func (r *Client) LPopCount(key string, count int) ([]string, error)
- func (r *Client) LPush(key string, values ...interface{}) error
- func (r *Client) RPopCount(key string, count int) ([]string, error)
- func (r *Client) RPush(key string, values ...interface{}) error
- func (r *Client) Set(key string, value interface{}, expirations ...time.Duration) error
- func (r *Client) SetContext(ctx context.Context) *Client
- type ClientOptions
- type Interface
- type Mock
- func (m *Mock) BLPop(timeout time.Duration, keys ...string) ([]string, error)
- func (m *Mock) BRPop(timeout time.Duration, keys ...string) ([]string, error)
- func (m *Mock) Clear() error
- func (m *Mock) Del(keys ...string) (int64, error)
- func (m *Mock) Get(key string) (string, error)
- func (m *Mock) LPopCount(key string, count int) ([]string, error)
- func (m *Mock) LPush(key string, values ...interface{}) error
- func (m *Mock) RPopCount(key string, count int) ([]string, error)
- func (m *Mock) RPush(key string, values ...interface{}) error
- func (m *Mock) Set(key string, value interface{}, expirations ...time.Duration) error
- func (m *Mock) SetContext(ctx context.Context) *Client
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
}
Client represents a Redis client with context.
func New ¶
func New(options ClientOptions) (*Client, error)
New creates a new Redis client with the given options.
func (*Client) BLPop ¶
BLPop removes and returns the first element of the list stored at keys, blocking until one is available.
func (*Client) BRPop ¶
BRPop removes and returns the last element of the list stored at keys, blocking until one is available.
type ClientOptions ¶
type ClientOptions struct { Host string // Host of the Redis server. Port int // Port of the Redis server. Password string // Password for authentication with the Redis server. DB int // Redis database number to select. PoolSize int // Maximum number of connections in the pool. }
ClientOptions holds the options for creating a new Redis client.
type Interface ¶
type Interface interface { LPush(key string, values ...interface{}) error RPush(key string, values ...interface{}) error BRPop(timeout time.Duration, keys ...string) ([]string, error) BLPop(timeout time.Duration, keys ...string) ([]string, error) Set(key string, value interface{}, expirations ...time.Duration) error Get(key string) (string, error) Del(keys ...string) (int64, error) Clear() error LPopCount(key string, count int) ([]string, error) RPopCount(key string, count int) ([]string, error) SetContext(ctx context.Context) *Client }
Interface defines the methods that a Redis client should implement.
Click to show internal directories.
Click to hide internal directories.