Skip to main content
Version: v1.40.0

Redis

Overview​

Load the configuration from Redis using a specific prefix.

Redis Format​

If you use Redis to store your flags, you need a specific format to store your flags.

We expect the flag to be stored as a string:string format where the key if the flag key (with or without a prefix) and the value is a string representing the flag in JSON.

The retriever will Scan redis filtering with the Prefix and will parse the value as a JSON object.

The retriever will read all the flags from Redis at once.

Configure the relay proxy​

To configure your relay proxy to use the Redis retriever, you need to add the following configuration to your relay proxy configuration file:

goff-proxy.yaml
# ...
retrievers:
- kind: redis
options:
addr: "127.0.0.1:6379"
prefix: "goff:"
# ...
Field nameMandatoryTypeDefaultDescription
kindstringnoneValue should be redis.
This field is mandatory and describes which retriever you are using.
optionsobjectnoneOptions used to connect to your redis instance.
All the options from the go-redis SDK are available (check redis.Options)
prefixstringnonePrefix used before your flag name in the Redis DB.

Configure the GO Module​

To configure your GO module to use the Redis retriever, you need to add the following configuration to your ffclient.Config{} object:

example.go
err := ffclient.Init(ffclient.Config{
PollingInterval: 3 * time.Second,
Retriever: &redisRetriver.Retriever{
Prefix: "goff:",
Options: &redis.Options{
Addr: "127.0.0.1:6379",
},
},
})
defer ffclient.Close()
FieldMandatoryDescription
OptionsA redis.Options object containing the connection information to the redis instance.
PrefixKey prefix to filter on the key names.