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
0
votes
1 answer

Testing with Golang, redis and time

I was trying to test a bit with Redis for the first time and I bumped into some confusion with HGET/HSET/HGETALL. My main problem was that I needed to store time, and I wanted to use a hash as I'll continuously update the time. At first I read about…
Jon
  • 322
  • 1
  • 11
0
votes
1 answer

Am I using redigo HDEL correctly?

I seem to have the correct usage for using the HDEL command interface, but seem to get 0 records deleted. Am I missing something here? Here are useful code snippets: This doesn't work: keysToDeleteArr []string //this has valid key values from…
Anup Puri
  • 65
  • 6
0
votes
1 answer

Convert Redis subscribe []uint8 output to string

I am using the code mentioned below to get output from Redis Publish-Subscribe. The message passed during the Redis publish a string (test-message). However, the output that I get during subscribe stage is of type []uint8. Following is the output…
Ling Guo
  • 592
  • 4
  • 12
0
votes
1 answer

How to receive Redis publish message in Go

I am trying to use Redis PubSub in Go to be able pass / publish a message and retrieve it during subscription. I have been able to set the publish and subscribe / PubSub parts of the code properly. Below is my code. The (string) message that I…
Ling Guo
  • 592
  • 4
  • 12
0
votes
1 answer

Redigo connection pool - how to get more connections?

I am building a performance oriented REST-API. The skeleton was built with go-swagger. The API has 3ms to answer and is succeeding in single-use while only needing between 0.5ms - 0.8ms for the response. There are two calls made to redis. This is…
whatever.idc
  • 92
  • 1
  • 1
  • 10
0
votes
0 answers

redigo error log: write: connection reset by peer

Almost the same amount of time (point in time as redigo error log: write: connection reset by peer?), redis error log: Client id=45183 addr=127.0.0.1:40420 fd=39 name= age=39706 idle=46 flags=N db=0 sub=8 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=16114…
0
votes
1 answer

Redigo type of value returned from GET

I'd like to be able to GET a value of a key and immediately know what type it is. I'm using res, err := conn.Do("GET", key) This returns an interface{} in res. Depending on the type, I'd like to call one of the helper functions like…
Marc Bacvanski
  • 1,458
  • 4
  • 17
  • 33
0
votes
0 answers

Receiving EOF from redis when subscribing to a channel

Redis has some sort of timeout after 1hr, which raises EOF error when I'm subscribing to some channels. My Code: pubsub := redis.PubSubConn{Conn: rc} events := ["controller"] err = pubsub.Subscribe(events) if err != nil { return } for { …
Yuval Pruss
  • 8,716
  • 15
  • 42
  • 67
0
votes
0 answers

How to set a timeout when evaluating a script using redigo?

I'm using redigo (github.com/gomodule/redigo/redis) to evaluting some lua scripts on redis. However, I read the related GoDoc, I can't find any methods to set a timeout when evaluating a lua script using the redis.Script type. The Script.Do method…
xianye
  • 1
0
votes
2 answers

Error - redigo.Scan: Cannot convert from Redis bulk string to *string

I have a struct like that type User struct { Nickname *string `json:"nickname"` Phone *string `json:"phone"` } Values ​​are placed in redis with HMSET command. (values ​​can be nil) Now I'm trying to scan values ​​into a…
Daniele
  • 33
  • 5
0
votes
1 answer

Redigo: How can I get a key-value map from Redis using Golang?

Let's say I have this set of keys in my Redis: KEY VALUE "agent_100" "{name: Agent1, status:online}" "agent_200" "{name: Agent2, status:offline}" "agent_300" "{name: Agent3, status:online}" "agent_400" "{name: Agent4,…
ef0ntan
  • 53
  • 1
  • 9
0
votes
1 answer

Error unmarshaling when getting array of struct from redis

I am using redigo to save some structs in redis. The thing is that for the same key I need to append new structs, but when I am trying to recover them I cannot unmarshal to an array. Ie: (ignoring the errors intentionally) type ADTO struct { …
hosseio
  • 1,142
  • 2
  • 12
  • 25
0
votes
1 answer

Is there any auto incremention machanim for storing keys' values in redis with redigo wrapper?

I'm new to go programming language and just wanted to write a small web app project with a good architecture. I get some specific recangle objects through a post request. type Rectangle struct { X int //starting x coordinate Y int…
0
votes
0 answers

read tcp 127.0.0.1:51719->127.0.0.1:6379: read: connection reset by peer

Here is my code func BenchmarkParallelGetSet(b *B) { parallel := runtime.GOMAXPROCS(0) * 8 b.Run("redigo", func(b *B) { do(b, func() { conn := red.Get() //defer conn.Close() v, err :=…
user3051532
  • 9
  • 1
  • 2
0
votes
1 answer

Best way to provide redis client for extensible go applications

I'm using redigo in an application and I'm wondering how my services should interface with Redis. Wikipedia has this to say about thread-safety: Thread safety is a computer programming concept applicable to multi-threaded code. Thread-safe code…
franklin
  • 1,800
  • 7
  • 32
  • 59