summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-redis/redis/command.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-04-16 05:37:14 -0700
committerJoram Wilander <jwawilander@gmail.com>2018-04-16 08:37:14 -0400
commit6e2cb00008cbf09e556b00f87603797fcaa47e09 (patch)
tree3c0eb55ff4226a3f024aad373140d1fb860a6404 /vendor/github.com/go-redis/redis/command.go
parentbf24f51c4e1cc6286885460672f7f449e8c6f5ef (diff)
downloadchat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.gz
chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.bz2
chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.zip
Depenancy upgrades and movign to dep. (#8630)
Diffstat (limited to 'vendor/github.com/go-redis/redis/command.go')
-rw-r--r--vendor/github.com/go-redis/redis/command.go26
1 files changed, 25 insertions, 1 deletions
diff --git a/vendor/github.com/go-redis/redis/command.go b/vendor/github.com/go-redis/redis/command.go
index 480a5ce19..1588ca251 100644
--- a/vendor/github.com/go-redis/redis/command.go
+++ b/vendor/github.com/go-redis/redis/command.go
@@ -10,6 +10,7 @@ import (
"github.com/go-redis/redis/internal"
"github.com/go-redis/redis/internal/pool"
"github.com/go-redis/redis/internal/proto"
+ "github.com/go-redis/redis/internal/util"
)
type Cmder interface {
@@ -436,7 +437,7 @@ func NewStringCmd(args ...interface{}) *StringCmd {
}
func (cmd *StringCmd) Val() string {
- return internal.BytesToString(cmd.val)
+ return util.BytesToString(cmd.val)
}
func (cmd *StringCmd) Result() (string, error) {
@@ -1022,3 +1023,26 @@ func (cmd *CommandsInfoCmd) readReply(cn *pool.Conn) error {
cmd.val = v.(map[string]*CommandInfo)
return nil
}
+
+//------------------------------------------------------------------------------
+
+type cmdsInfoCache struct {
+ once internal.Once
+ cmds map[string]*CommandInfo
+}
+
+func newCmdsInfoCache() *cmdsInfoCache {
+ return &cmdsInfoCache{}
+}
+
+func (c *cmdsInfoCache) Do(fn func() (map[string]*CommandInfo, error)) (map[string]*CommandInfo, error) {
+ err := c.once.Do(func() error {
+ cmds, err := fn()
+ if err != nil {
+ return err
+ }
+ c.cmds = cmds
+ return nil
+ })
+ return c.cmds, err
+}