Documentation
¶
Overview ¶
Package redisTools provides a wrapper functions for Redis database interactions.
Index ¶
- func Del(key string, redisConfig RedisConfiguration) error
- func EGet(key string, redisConfig RedisConfiguration) (string, error)
- func ESet(key string, value string, expirationInHours int, ...) error
- func Exists(key string, redisConfig RedisConfiguration) (bool, error)
- func Get(key string, redisConfig RedisConfiguration) (string, error)
- func Keys(pattern string, redisConfig RedisConfiguration) ([]string, error)
- func RedisOptions(redisConfig RedisConfiguration) *redis.Options
- func Set(key string, value string, expirationInHours int, ...) error
- func TestAccess(redisConfig RedisConfiguration) error
- func TestConnection(redisConfig RedisConfiguration) error
- type RedisClient
- func (r *RedisClient) BRPop(key string, timeout time.Duration) (string, error)
- func (r *RedisClient) Close() error
- func (r *RedisClient) Del(key string) error
- func (r *RedisClient) EGet(key string) (string, error)
- func (r *RedisClient) ESet(key string, value string, expirationInHours int) error
- func (r *RedisClient) ESetT(key string, value string, expiration time.Duration) error
- func (r *RedisClient) Exists(key string) (bool, error)
- func (r *RedisClient) Get(key string) (string, error)
- func (r *RedisClient) Keys(pattern string) ([]string, error)
- func (r *RedisClient) LLen(key string) (int64, error)
- func (r *RedisClient) LPush(key string, value string) error
- func (r *RedisClient) PTTL(key string) (time.Duration, error)
- func (r *RedisClient) RPop(key string) (string, error)
- func (r *RedisClient) Set(key string, value string, expirationInHours int) error
- func (r *RedisClient) SetT(key string, value string, expiration time.Duration) error
- func (r *RedisClient) TTL(key string) (time.Duration, error)
- type RedisConfigEncryption
- type RedisConfigHost
- type RedisConfiguration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Del ¶
func Del(key string, redisConfig RedisConfiguration) error
Delete a key from Redis (legacy function) DEPRECATED: Use the RedisClient methods directly instead
func EGet ¶
func EGet(key string, redisConfig RedisConfiguration) (string, error)
Get a value from Redis with encryption (legacy function)
DEPRECATED: Use the RedisClient methods directly instead
func ESet ¶
func ESet(key string, value string, expirationInHours int, redisConfig RedisConfiguration) error
Set a value in Redis with encryption (legacy function)
DEPRECATED: Use the RedisClient methods directly instead
func Exists ¶ added in v0.0.31
func Exists(key string, redisConfig RedisConfiguration) (bool, error)
Exists checks if a key exists (legacy function)
DEPRECATED: Use the RedisClient methods directly instead
func Get ¶
func Get(key string, redisConfig RedisConfiguration) (string, error)
Get a value from Redis (legacy function)
DEPRECATED: Use the RedisClient methods directly instead
func Keys ¶
func Keys(pattern string, redisConfig RedisConfiguration) ([]string, error)
Keys returns all keys based on a pattern (legacy function)
DEPRECATED: Use the RedisClient methods directly instead
func RedisOptions ¶
func RedisOptions(redisConfig RedisConfiguration) *redis.Options
RedisOptions returns a new Redis options struct
func Set ¶
func Set(key string, value string, expirationInHours int, redisConfig RedisConfiguration) error
Set a value in Redis (legacy function) DEPRECATED: Use the RedisClient methods directly instead
func TestAccess ¶
func TestAccess(redisConfig RedisConfiguration) error
TestAccess tests the access to Redis
func TestConnection ¶
func TestConnection(redisConfig RedisConfiguration) error
TestConnection tests the connection to Redis
Types ¶
type RedisClient ¶ added in v0.0.34
type RedisClient struct {
// contains filtered or unexported fields
}
RedisClient struct for Redis client
func NewRedisClient ¶ added in v0.0.34
func NewRedisClient(config RedisConfiguration) *RedisClient
NewRedisClient returns a new Redis client
func (*RedisClient) BRPop ¶ added in v0.0.36
BRPop pops a value from the right of a list blocking for a specified duration
Note: This will only return the very rightmost value in the list, not all values
func (*RedisClient) Close ¶ added in v0.0.34
func (r *RedisClient) Close() error
Close closes the Redis connection
func (*RedisClient) Del ¶ added in v0.0.34
func (r *RedisClient) Del(key string) error
Delete a key from Redis
func (*RedisClient) EGet ¶ added in v0.0.34
func (r *RedisClient) EGet(key string) (string, error)
Get a value from Redis with encryption
func (*RedisClient) ESet ¶ added in v0.0.34
func (r *RedisClient) ESet(key string, value string, expirationInHours int) error
Set a value in Redis with encryption
func (*RedisClient) ESetT ¶ added in v0.0.35
Set a value in Redis with encryption and a time.Duration instead of int
func (*RedisClient) Exists ¶ added in v0.0.34
func (r *RedisClient) Exists(key string) (bool, error)
Exists checks if a key exists
func (*RedisClient) Get ¶ added in v0.0.34
func (r *RedisClient) Get(key string) (string, error)
Get a value from Redis
func (*RedisClient) Keys ¶ added in v0.0.34
func (r *RedisClient) Keys(pattern string) ([]string, error)
Keys returns all keys based on a pattern
func (*RedisClient) LLen ¶ added in v0.0.36
func (r *RedisClient) LLen(key string) (int64, error)
LLen returns the length of a list
func (*RedisClient) LPush ¶ added in v0.0.36
func (r *RedisClient) LPush(key string, value string) error
LPush pushes a value to the left of a list returning an err if it fails
func (*RedisClient) PTTL ¶ added in v0.0.37
func (r *RedisClient) PTTL(key string) (time.Duration, error)
PTTL (milliseconds) returns the time to live of a key in time.Duration
func (*RedisClient) RPop ¶ added in v0.0.36
func (r *RedisClient) RPop(key string) (string, error)
RPop pops a value from the right of a list returning the value and an err if it fails
func (*RedisClient) Set ¶ added in v0.0.34
func (r *RedisClient) Set(key string, value string, expirationInHours int) error
Set a value in Redis
type RedisConfigEncryption ¶ added in v0.0.20
type RedisConfigEncryption struct { Key []byte DisloConfig *encryption.DisloConfig }
type RedisConfigHost ¶ added in v0.0.20
type RedisConfiguration ¶
type RedisConfiguration struct { Host RedisConfigHost Encryption RedisConfigEncryption }
RedisConfiguration struct for Redis configuration