Documentation ¶
Index ¶
- type Deserializer
- type ObjectMap
- type RedisClient
- type RedisClientImpl
- func (client *RedisClientImpl) HDel(hash string, field string) error
- func (client *RedisClientImpl) HGet(hash string, field string) (string, error)
- func (client *RedisClientImpl) HGetAll(hash string) (map[string]string, error)
- func (client *RedisClientImpl) HSet(hash string, field string, value string) error
- type RedisMap
- type Serializer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deserializer ¶
Deserializer turns a string into an object
type ObjectMap ¶
type ObjectMap interface { Set(key string, object interface{}) error Delete(key string) error Get(key string) (interface{}, error) GetAll() (map[string]interface{}, error) DeleteAll() error }
ObjectMap is an interface for getting objects from an arbitrary data store
type RedisClient ¶
type RedisClient interface { HSet(hash string, field string, value string) error HGet(hash string, field string) (string, error) HGetAll(hash string) (map[string]string, error) HDel(hash string, field string) error }
RedisClient defines an interface to interact with Redis. Only hash functions are used for now
func NewRedisClient ¶
func NewRedisClient() (RedisClient, error)
NewRedisClient gets the redis configuration from the service config and returns a new client or an error if something went wrong
type RedisClientImpl ¶
RedisClientImpl is the implementation of the redis client using an actual connection to redis using go-redis
func (*RedisClientImpl) HDel ¶
func (client *RedisClientImpl) HDel(hash string, field string) error
HDel deletes a value at a hash,field pair
func (*RedisClientImpl) HGet ¶
func (client *RedisClientImpl) HGet(hash string, field string) (string, error)
HGet gets a value at a hash,field pair
type RedisMap ¶
type RedisMap struct {
// contains filtered or unexported fields
}
RedisMap is an ObjectMap that stores objects in Redis using hash functions
func NewRedisMap ¶
func NewRedisMap( client RedisClient, hash string, serializer Serializer, deserializer Deserializer, ) *RedisMap
NewRedisMap creates a new redis map
type Serializer ¶
Serializer turns an object into a string