Questions tagged [go-redis]
59 questions
11
votes
2 answers
When I using `go install`, it returns not a main package
I used import "github.com/go-redis/redis/v8" in my code. The environment is go1.17.2 Windows AMD64. I executed go install github.com/go-redis/redis/v8@latest, but the result is package github.com/go-redis/redis/v8 is not a main package. What's wrong…

Eternally_Ascend
- 163
- 1
- 2
- 7
7
votes
1 answer
$GOPATH/go.mod exists but should not when building docker container, but works if I manually run commands
I'm building a golang:1.14.2 docker container with go-redis from a Dockerfile.
FROM golang:1.14.2
# project setup and install go-redis
RUN mkdir -p /go/delivery && cd /go/delivery && \
go mod init example.com/delivery && \
go get…

Yuriy F
- 351
- 1
- 2
- 13
5
votes
1 answer
How to read from redis replica with go-redis
We have a go lang service which will go to redis, to fetch data for each request and we want to read data from redis slave node as well. We went through the documentation of redis and go-redis library and found that, in order to read data from redis…
5
votes
2 answers
Can't marshal, (implement encoding.BinaryMarshaler). go-redis Sdd with multiple objects
I have a following piece of code in which I am trying to add an array to a redis set but it is giving me an error.
package main
import (
"encoding/json"
"fmt"
"github.com/go-redis/redis"
)
type Info struct {
Name string
Age …

Ahmed Nawaz Khan
- 1,451
- 3
- 20
- 42
4
votes
2 answers
go-redis Eval func return value type, when Lua script returns an array
When a Lua script returns a table array during an Eval call, how can it be converted to a []string in go?
The redis cli returns bulk replies in the following format.
1) val1
2) val2
Will go-redis eval function return the bulk entries as
["val1",…

TruBlu
- 441
- 1
- 4
- 15
3
votes
1 answer
Memory efficient way to use Redis pubsub on per user basis in go service?
We use GraphQL subscriptions that push data to the client. On the GraphQl server, written in golang, we connect to a pubsub channel for each user subscription (channel is unique for each user). While testing we noticed that the go service memory…

cgvalayev
- 33
- 3
2
votes
1 answer
How to disable internal logging of go-redis package
I am a bit new to go lang. So need some help here.
I am using the go-redis package to make connection to redis using redis sentinal.
Package :
github.com/go-redis/redis/v9
Now My problem is that whenever I execute my code it do the internal logging…

vibhor mittal
- 21
- 1
2
votes
0 answers
Redis Keyspace notification not working for go-redis in cluster mode
I am using go-redis/v8 as a client library and its universal client to get/set etc.
I am subscribing to the keyspace notifications like the one below.
keyspace := fmt.Sprintf("__keyspace@%d__:%s", s.config.Redis.DB, key)
ch :=…

Dipto Mondal
- 624
- 1
- 4
- 14
2
votes
1 answer
I want to connect to Elasticcache for redis in which cluster mode is enabled. I want to connect it from golang (go-redis pkg)
In Golang,Go redis has 2 clients, redis.NewClient and redis.NewClusterClient.
I am not sure which one to use for connecting to elasticcache for redis.
I want to use the client which will only connect to one endoint of cluster and that enpoint will…

Darshan Mestry
- 49
- 5
2
votes
1 answer
Go Redis JSONGet to map
Been dabbing in Redis with Go 1.19 as the backend lang and have been stuck trying to convert the JSONGet return value (res interface{}) to a map. I'm using "github.com/nitishm/go-rejson/v4" as the Redis JSON library.

RamelHenderson
- 2,151
- 2
- 13
- 12
2
votes
0 answers
golang go-redis package, Why don't we use V8 to call packages when we refer to them?
Consider package github.com/go-redis/redis/v8; its path ends with v8. So why, when we need to use function NewClient from that package, do we write redis.NewClient and not v8.NewClient?
package main
import (
…

zhshou
- 39
- 2
2
votes
0 answers
go-redis: Wait() commands throws an i/o timeout error while LPush and HGet work
I'm seeing the following error on running the Wait() command in go-redis in a private repo:
read tcp xxx.xxx.xxx.x:xxx1-> xxx.xxx.xxx.x:xxx9: i/o timeout
Surprisingly, I use LPUSH, HSET commands in the same function which pass but as soon as I want…

Akshat Raika
- 31
- 1
2
votes
0 answers
How to connect to failovered replication Redis when using go-redis library
In redis cluster mode, even if one of the registered masters shuts down, redirection is performed and the application works without any problem.
package main
import (
"fmt"
"github.com/go-redis/redis"
"log"
"strconv"
…

battlecook
- 471
- 6
- 17
2
votes
2 answers
Mocking redis server with miniredis fails
Golang newbie here :)
I have a redis client wrapper over go-redis and I want to test that it works properly. I have tried using miniredis to mock the redis server I would be connecting to, but I keep getting an error.
When I have everything in the…

idohu
- 133
- 3
- 7
1
vote
1 answer
Can we specify a pattern on shared Redis keyspace event notification that expired?
I am currently using a shared Redis server and was able to get all redis keyspace events that expired using the following configurations below.
redis.conf
# use key-space notification
notify-keyspace-events Ex
application (golang, redis/v8)
pubSub…

Louie Miranda
- 1,071
- 1
- 20
- 36