Questions tagged [redigo]

Redigo is a Go client for the Redis database

Redigo is a Go client for the Redis database.

Features:

  • A Print-like API with support for all Redis commands.
  • Pipelining, including pipelined transactions.
  • Publish/Subscribe.
  • Connection pooling.
  • Script helper type with optimistic use of EVALSHA.
  • Helper functions for working with command replies.

Github: https://github.com/garyburd/redigo

API Reference: https://godoc.org/github.com/garyburd/redigo/redis

76 questions
1
vote
0 answers

Redis Key Scan not always returning all the values

I have an issue where my Redis key SCAN (with a wildcard) does not appear to consistently be returning all the values. It works correctly many times but not all the time. Maybe I don't understand how scan is supposed to work. I am using redigo as…
mornindew
  • 1,993
  • 6
  • 32
  • 54
1
vote
1 answer

Redis losing connection in docker container

I am making a PubSub using redigo and the connection is created by redis pool. This is the Redis Pool code: package main import ( "os" "os/signal" "syscall" "time" "github.com/gomodule/redigo/redis" ) type IRedis interface { …
1
vote
1 answer

should I check error each step on a redis multi transaction?

should I check error each step on a redis multi transaction? if some error happen, was it mean, the release command will also return error? eg. can I : conn.Do("multi") conn.Do("set", "mm", "xx") reply, err := conn.Do("exec") if err != nil { …
ruandao
  • 410
  • 4
  • 11
1
vote
1 answer

redis: dial tcp [REDIS ADDRESS] connect: connection refused

I'm using redigo in go with docker. I have a server that processes incoming events and uses redis for rate limiting. One in every 100k+ connections or so I get the following error: redis: dial tcp IP ADDRESS: connect: connection refused The…
Schroedinger
  • 1,273
  • 14
  • 32
1
vote
2 answers

How to get all values by wildcard key in redis

Let say I have following data in redis: key value user-1-xxxx data1 user-1-yyyy data2 user-1-tttt data3 So, can I get all above records by wildcard user-1-* (including the keys and values). I tried KEYS user-1-* ,…
dev-jim
  • 2,404
  • 6
  • 35
  • 61
1
vote
1 answer

redigo different pool connect to single server

so, i have a necessity to connect to 3 redis server. i create 3 connection pool, and initialize each of them. but redigo seems only connected to single redis server, although i get the connection using different pool. using redigo, here's my code…
boes
  • 13
  • 3
1
vote
1 answer

Redigo: Fail fast when redis server is down

I'm struggling with getting go to fail fast when the redis server I'm connected to goes down, want to have a robust solution. I'm using redigo and I'm setting up a connection pool like so: // This has other stuff in it in the code, use it as a //…
Calvin Brizzi
  • 25
  • 1
  • 6
1
vote
1 answer

redigo connection pool - Why release lock when removing stale connection

Redigo is a golang client for the redis database. It uses struct Pool to maintain a pool of connections. This struct holds a mutex lock for application putting and getting connection parallelly. type Pool struct { // ... IdleTimeout…
lorneli
  • 252
  • 3
  • 11
1
vote
1 answer

HMGET: Empty result when passing params

Using redigo, I'm trying to use HMGET. I'm passing a string slice as param in field. It is not working, returning empty result. func HMGET(c redis.Conn, field []string)(){ if err := c.Send("HMGET", HashName, field); err != nil { …
Ankit Deshpande
  • 3,476
  • 1
  • 29
  • 42
1
vote
1 answer

redigo and gob how to retrieve slices of gob data

I'm pushing in my redis base my objects with the "RPUSH" command. // object is of type interface var network bytes.Buffer gob.NewEncoder(&network) enc.Encode(object /* interface{} */) redis.String(d.Conn.Do("RPUSH", "objects",…
Mr Bonjour
  • 3,330
  • 2
  • 23
  • 46
1
vote
2 answers

Convert interface{} into []string in Golang

I am new to GO language and I am trying to get a value from a function which returns two strings, that is [str1, str2] ret, err := fun1(....) And function's prototype is func fun1(...) (interface{}, error) I print ret, it is [[57 57 56 56] [97…
simon_xia
  • 2,394
  • 1
  • 20
  • 32
1
vote
1 answer

Inadequate RAM usage by Redis

I'm developing an API using Go and Redis. The problem is that RAM usage is inadequate and I can't find the root of the problem. TL;DR version There are hundreds/thousands of hash objects. Each one of 1 KB objects (key+value) takes ~0.5 MB of RAM.…
Max Malysh
  • 29,384
  • 19
  • 111
  • 115
1
vote
3 answers

Casting json parts into Go structs from Redis using redigo

I have a json that is POSTed by a browser. It's a hash with var id int64 = 123 and, say, three fields like so: myJson := `{ "a":"{'x1':'apple','x2':'orange'}", "b":"{'y1':345678,'y2':32456}", "c":"['alpha@example1.com',…
parens
  • 57
  • 1
  • 8
1
vote
1 answer

redigo: read redis hash that has variable keys

I need to read a redis hash from redigo. This hash has variable keys. This causes a problem because ScanStruct requires me to know those keys beforehand, so I can put it in a struct and unpack the HGETALL result into that struct. Is there a way to…
Sander Smits
  • 2,051
  • 3
  • 18
  • 16
1
vote
1 answer

Is Redigo Redis Pool really supposed to be a global variable?

In the example here Redigo Docs for Pool the redis pool is set as a global variable in func main. Is that a kosher way to do things? Should you really be using global varibales left and right or is there a better, more preferred way of accomplishing…
Adergaard
  • 760
  • 10
  • 24