Documentation ¶
Index ¶
- type Redis
- func (r *Redis) Exists(ctx context.Context, key string) (bool, error)
- func (r *Redis) Get(ctx context.Context, key string) ([]byte, error)
- func (r *Redis) GetClient() *redis.Client
- func (r *Redis) ValidateOptions() error
- func (r *Redis) Write(ctx context.Context, key string, value interface{}, expiration time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
Redis is a struct that holds the context, options, and the client for a Redis database.
func New ¶
New creates a new Redis client with the provided context and options. It returns a pointer to the Redis struct and an error if any occurred during the creation of the client.
func (*Redis) Exists ¶
Exists checks if a key exists in the Redis database. It returns a boolean indicating the existence of the key and an error if any occurred during the check.
func (*Redis) Get ¶
Get retrieves the value of a key from the Redis database. It returns the value as a byte slice and an error if any occurred during the retrieval.
func (*Redis) GetClient ¶
func (r *Redis) GetClient() *redis.Client
GetClient returns the Redis client.
func (*Redis) ValidateOptions ¶
ValidateOptions checks the validity of the options used to create a Redis client. It returns an error if any of the options are invalid.