forked from mirror/redis
Add debug object command.
This commit is contained in:
parent
2fd136fe6c
commit
8452fccfb8
|
@ -1165,3 +1165,11 @@ func (c *Client) ScriptLoad(script string) *StringCmd {
|
|||
c.Process(req)
|
||||
return req
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
func (c *Client) DebugObject(key string) *StringCmd {
|
||||
req := NewStringCmd("DEBUG", "OBJECT", key)
|
||||
c.Process(req)
|
||||
return req
|
||||
}
|
||||
|
|
|
@ -2900,14 +2900,14 @@ func (t *RedisTest) TestScriptingScriptLoad(c *C) {
|
|||
c.Assert(scriptLoad.Val(), Equals, "6b1bf486c81ceb7edf3c093f4c48582e38c0e791")
|
||||
}
|
||||
|
||||
func (t *RedisTest) TestNewScript(c *C) {
|
||||
func (t *RedisTest) TestScriptingNewScript(c *C) {
|
||||
s := redis.NewScript("return 1")
|
||||
run := s.Run(t.client, nil, nil)
|
||||
c.Assert(run.Err(), IsNil)
|
||||
c.Assert(run.Val(), Equals, int64(1))
|
||||
}
|
||||
|
||||
func (t *RedisTest) TestEvalAndPipeline(c *C) {
|
||||
func (t *RedisTest) TestScriptingEvalAndPipeline(c *C) {
|
||||
pipeline := t.client.Pipeline()
|
||||
s := redis.NewScript("return 1")
|
||||
run := s.Eval(pipeline, nil, nil)
|
||||
|
@ -2917,7 +2917,7 @@ func (t *RedisTest) TestEvalAndPipeline(c *C) {
|
|||
c.Assert(run.Val(), Equals, int64(1))
|
||||
}
|
||||
|
||||
func (t *RedisTest) TestEvalShaAndPipeline(c *C) {
|
||||
func (t *RedisTest) TestScriptingEvalShaAndPipeline(c *C) {
|
||||
s := redis.NewScript("return 1")
|
||||
c.Assert(s.Load(t.client).Err(), IsNil)
|
||||
|
||||
|
@ -2931,6 +2931,24 @@ func (t *RedisTest) TestEvalShaAndPipeline(c *C) {
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
func (t *RedisTest) TestCmdDebugObject(c *C) {
|
||||
{
|
||||
debug := t.client.DebugObject("foo")
|
||||
c.Assert(debug.Err(), Not(IsNil))
|
||||
c.Assert(debug.Err().Error(), Equals, "ERR no such key")
|
||||
}
|
||||
|
||||
{
|
||||
t.client.Set("foo", "bar")
|
||||
debug := t.client.DebugObject("foo")
|
||||
c.Assert(debug.Err(), IsNil)
|
||||
c.Assert(debug.Val(), FitsTypeOf, "")
|
||||
c.Assert(debug.Val(), Not(Equals), "")
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
func (t *RedisTest) BenchmarkRedisPing(c *C) {
|
||||
for i := 0; i < c.N; i++ {
|
||||
if err := t.client.Ping().Err(); err != nil {
|
||||
|
|
Loading…
Reference in New Issue