Questions tagged [go-redis]

59 questions
0
votes
0 answers

Not work NoAck in XReadGroup with go-redis

The package I use to generate the connection and read the messages is: "github.com/go-redis/redis" I am trying to declare not to use NOACK when I read events from a group in golang, but when a new event arrives, it leaves this new event as if it had…
0
votes
1 answer

How to get get value from redis.Cmder in golang go-redis?

temp1Ctx, temp1Cancer := lib.GetTimeoutCtx(ctx) pipeline := util.RedisClusterClient.Pipeline() for _, key := range userIdRedisSlice { pipeline.HMGet(temp1Ctx, key, userIdRedisFeature...) } userProfile, err :=…
DachuanZhao
  • 1,181
  • 3
  • 15
  • 34
0
votes
0 answers

Weird IP showing up in logs for Redis client in Go

Recently in one of our k8s deployments we are seeing a weird IP showing up in our logs. This error log is related to one of our services which is using the go-redis. Here is the body of the error log: "jsonPayload":{ …
2hamed
  • 8,719
  • 13
  • 69
  • 112
0
votes
1 answer

Redis multiple tables?

I have a use case where I have to search by key and in another use case, I have to search by value. Given this scenario, what's the best approach as scanning the entire cache can degrade performance (to filter by value). Do reverse store i.e store…
Arun Gopalpuri
  • 2,340
  • 26
  • 27
0
votes
1 answer

Is there a way to check subscribers number connected to pattern in redis?

I want to check how many users are connected to my pubsub pattern. Is there a simple way to do it in Go? Thank you. pubsub := env.redisCli.PSubscribe(name) defer pubsub.Close() I have tried this: val, _ := env.redisCli.Do("pubsub",…
Rogalek
  • 50
  • 10
0
votes
1 answer

Why can't convert string to int with value got by go-redis?

I'm using go-redis in go to get list data from Redis. IDs, err := redisClient.LRange("ID", 0, -1).Result() if err != nil { panic(err) } fmt.Println(IDs) for _, ID := range IDs { id, _ := strconv.Atoi(ID) fmt.Println(id) } In the first…
iooi
  • 453
  • 2
  • 10
  • 23
0
votes
1 answer

Mock Redis Cluster Server in Golang

How to mock redis cluster server in Golang ? Simple redis server can be mocked using 'github.com/alicebob/miniredis' package but it does not support cluster mocking. Received the following error: ERR unknown command cluster, with args beginning…
0
votes
2 answers

Go Redis convert HGetAll result to struct

I'm getting data from the redis.HGetAll but found no clean way to convert results into my Struct. var object struct { x int } result := redisClient.HGetAll(context.Background(), "the_h_key") //TODO import the result content into the object…
Amin Shojaei
  • 5,451
  • 2
  • 38
  • 46
0
votes
1 answer

Redis memory usage CLI does not work on cluster

I using the go-redis library to check memory usage of a specific key on a Redis cluster. The library fails sporadically with error "redis: nil" which usually means that it accesses the wrong redis instance to find the key. The go-redis library is…
alonana
  • 171
  • 2
  • 12
0
votes
1 answer

Webserver cannot connect to Redis via docker-compose

I am trying to connect to a redis instance on a docker network via a webserver on the same network. My code is in go and I'm using My docker-compose.yml: thor-redis: image: redis:5.0.7 networks: - thorcast ports: -…
K Pekosh
  • 633
  • 1
  • 6
  • 15
-1
votes
2 answers

Does WithContext method need to panic if context is nil?

I want to write a WithContext method for a struct and am taking inspiration from net/http's Request.WithContext. My question is: why does Request.WithContext panic if the context is nil: func (r *Request) WithContext(ctx context.Context) *Request { …
Algebra8
  • 1,115
  • 1
  • 10
  • 23
-1
votes
1 answer

How do I get and set data from redis in Go?

var rdb *redis.Client var ctx = context.Background() rdb = redis.NewClient(&redis.Options{ Addr: "localhost:6379", Password: "", // no password set DB: 0, // use default DB }) // set for 24 hours err :=…
chovy
  • 72,281
  • 52
  • 227
  • 295
-1
votes
1 answer

Wrong type operation when attempting to LPOP from a list in redis

I'm playing around with redis using golang but i keep getting an error when i attempt to LPOP an element from the list. It works only when i insert the first element in the list but when i attempt to add the second element i keep getting the error…
EI-01
  • 1,075
  • 3
  • 24
  • 42
-2
votes
1 answer

too many open files in Redis

In our project, we are using a single instance of Redis (hosted on GCP) with total memory of 4 GB, out of which only 2 GB is used as of now. The total connection limit is 1000. A few days ago, we noticed an unexpected error (for a few minutes) while…
1 2 3
4