Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) Del(ctx context.Context, key string) error
- func (c *Client) Exists(ctx context.Context, key string) (bool, error)
- func (c *Client) Expire(ctx context.Context, key string, expiration time.Duration) error
- func (c *Client) Get(ctx context.Context, key string) (string, error)
- func (c *Client) GetInt(ctx context.Context, key string, defaultVal int) (int, error)
- func (c *Client) GetJSON(ctx context.Context, key string, dest any) error
- func (c *Client) GetTTL(ctx context.Context, key string) (time.Duration, error)
- func (c *Client) HGet(ctx context.Context, key, field string) (string, error)
- func (c *Client) HSet(ctx context.Context, key, field string, value interface{}) error
- func (c *Client) Incr(ctx context.Context, key string) (int64, error)
- func (c *Client) IncrBy(ctx context.Context, key string, value int64) (int64, error)
- func (c *Client) IncreaseWithExpiry(ctx context.Context, key string, expiry time.Duration) (int64, error)
- func (c *Client) Keys(ctx context.Context, pattern string) ([]string, error)
- func (c *Client) Pipeline() redis.Pipeliner
- func (c *Client) SAdd(ctx context.Context, key string, members ...interface{}) error
- func (c *Client) SMembers(ctx context.Context, key string) ([]string, error)
- func (c *Client) SRem(ctx context.Context, key string, members ...interface{}) error
- func (c *Client) Set(ctx context.Context, key string, value any, expiration time.Duration) error
- func (c *Client) SetJSON(ctx context.Context, key string, value any, expiration time.Duration) error
- func (c *Client) Transaction(ctx context.Context, fn func(tx *redis.Tx) error) error
- type ClientParams
- type Pipeliner
- type StringCmd
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Nil = redis.Nil ErrConfigNil = eris.New("redis config is nil") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { *redis.Client // contains filtered or unexported fields }
Client wraps the Redis client with additional functionality
func NewClient ¶
func NewClient(p ClientParams) (*Client, error)
NewClient creates a new Redis client instance with the provided configuration and logger.
func (*Client) GetInt ¶
GetInt retrieves an integer value for a key from Redis, returning a default value if the key does not exist.
func (*Client) GetJSON ¶
GetJSON retrieves a JSON-encoded value from Redis and unmarshals it into the provided destination.
func (*Client) IncrBy ¶
IncrBy increments the integer value of a key in Redis by a specified amount.
func (*Client) IncreaseWithExpiry ¶
func (c *Client) IncreaseWithExpiry(ctx context.Context, key string, expiry time.Duration) (int64, error)
IncreaseWithExpiry increments a key's value and sets an expiration time atomically.
func (*Client) Pipeline ¶
func (c *Client) Pipeline() redis.Pipeliner
Pipeline returns a new pipeline for batch operations
Click to show internal directories.
Click to hide internal directories.