You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cannot seemed to be able to get anything from LRange().
The use-case looks like this:
redisClient := redis.NewRing(&redis.RingOptions{
Addrs: map[string]string{"shard0": "localhost:6379"},
})
key := "abc_test|5m|1475024400|aaa.bbb"
// Set
redisClient.RPush(key, 1)
redisClient.RPush(key, 2)
// I then opened redis-cli and checked that there are 2 values.
// Get all of them
result, err := redisClient.LRange(key, 0, -1).Result()
// err is nil and I get empty slice.
// Curiously, I created a simple Redis client and still get empty result.
simple := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
})
result, err := simple.LRange(key, 0, -1).Result() // Still empty.
It's a fairly straight forward usage. I must be missing something here.
package main
import (
"fmt"
redis "gopkg.in/redis.v4"
)
func main() {
redisClient := redis.NewRing(&redis.RingOptions{
Addrs: map[string]string{"shard0": "localhost:6379"},
})
key := "abc_test|5m|1475024400|aaa.bbb"
// Set
redisClient.RPush(key, 1)
redisClient.RPush(key, 2)
// I then opened redis-cli and checked that there are 2 values.
// Get all of them
result, err := redisClient.LRange(key, 0, -1).Result()
fmt.Println(result, err)
}
I cannot seemed to be able to get anything from
LRange()
.The use-case looks like this:
It's a fairly straight forward usage. I must be missing something here.
Systems Environment
The text was updated successfully, but these errors were encountered: