Documentation
¶
Overview ¶
Package redis implements a Redis client.
Index ¶
- Variables
- type Client
- func (c *Client) Close() error
- func (c *Client) Del(ctx context.Context, keys string) error
- func (c *Client) Get(ctx context.Context, key string) (string, error)
- func (c *Client) GetClient() *redis.Client
- func (c *Client) HGet(ctx context.Context, key, field string) ([]byte, error)
- func (c *Client) Set(ctx context.Context, key, value string, expireTime time.Duration) error
- func (c *Client) StreamSend(ctx context.Context, streamName string, msg []byte) error
- func (c *Client) XAck(ctx context.Context, topic, group string, ids ...string) error
- func (c *Client) XGroupConsume(ctx context.Context, topic, group, consumerName, id string, batchSize int) ([]redis.XMessage, error)
- func (c *Client) XGroupCreate(ctx context.Context, topic, group, start string) error
- func (c *Client) XGroupDelConsumer(ctx context.Context, topic, group, consumerName string) error
- func (c *Client) ZAddNX(ctx context.Context, key string, members ...redis.Z) error
- func (c *Client) ZRangeByScore(ctx context.Context, key string, opt *redis.ZRangeBy) ([]redis.Z, error)
- func (c *Client) ZRem(ctx context.Context, key string, members ...any) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrConsumerGroupExists is returned when the consumer group already exists ErrConsumerGroupExists = errors.New("BUSYGROUP Consumer Group name already exists") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client Redis client wrapper
func (*Client) Get ¶
Get executes the Redis GET command it returns the value of key. If the key does not exist the special value nil is returned.
func (*Client) Set ¶
Set executes the Redis SET command, expireTime time unit is seconds If expireTime is 0, it means not to set the expiration time
func (*Client) StreamSend ¶
StreamSend send message to stream
func (*Client) XGroupConsume ¶
func (c *Client) XGroupConsume(ctx context.Context, topic, group, consumerName, id string, batchSize int) ([]redis.XMessage, error)
XGroupConsume consumes messages from a stream
func (*Client) XGroupCreate ¶
XGroupCreate creates a new consumer group start argument is the ID of the first message to consume start can be specified as ID or $, where $ means from the last message
func (*Client) XGroupDelConsumer ¶
XGroupDelConsumer delete consumer from consumer group
func (*Client) ZAddNX ¶
ZAddNX executes the Redis ZAddNX command If the member already exists, the score is updated and the element reinserted at the right position to ensure the correct ordering.