You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

  1. Redis client for Golang [![Build Status](https://travis-ci.org/go-redis/redis.png?branch=master)](https://travis-ci.org/go-redis/redis)
  2. =======================
  3. Supports:
  4. - Redis 2.8 commands except QUIT, MONITOR, SLOWLOG and SYNC.
  5. - Pub/sub.
  6. - Transactions.
  7. - Pipelining.
  8. - Connection pool.
  9. - TLS connections.
  10. - Thread safety.
  11. - Timeouts.
  12. - Redis Sentinel.
  13. API docs: http://godoc.org/gopkg.in/redis.v2.
  14. Examples: http://godoc.org/gopkg.in/redis.v2#pkg-examples.
  15. Installation
  16. ------------
  17. Install:
  18. go get gopkg.in/redis.v2
  19. Look and feel
  20. -------------
  21. Some corner cases:
  22. SORT list LIMIT 0 2 ASC
  23. vals, err := client.Sort("list", redis.Sort{Offset: 0, Count: 2, Order: "ASC"}).Result()
  24. ZRANGEBYSCORE zset -inf +inf WITHSCORES LIMIT 0 2
  25. vals, err := client.ZRangeByScoreWithScores("zset", redis.ZRangeByScore{
  26. Min: "-inf",
  27. Max: "+inf",
  28. Offset: 0,
  29. Count: 2,
  30. }).Result()
  31. ZINTERSTORE out 2 zset1 zset2 WEIGHTS 2 3 AGGREGATE SUM
  32. vals, err := client.ZInterStore("out", redis.ZStore{Weights: []int64{2, 3}}, "zset1", "zset2").Result()
  33. EVAL "return {KEYS[1],ARGV[1]}" 1 "key" "hello"
  34. vals, err := client.Eval("return {KEYS[1],ARGV[1]}", []string{"key"}, []string{"hello"}).Result()