summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-redis/redis/redis_context.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-redis/redis/redis_context.go')
-rw-r--r--vendor/github.com/go-redis/redis/redis_context.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/github.com/go-redis/redis/redis_context.go b/vendor/github.com/go-redis/redis/redis_context.go
new file mode 100644
index 000000000..6ec811ca5
--- /dev/null
+++ b/vendor/github.com/go-redis/redis/redis_context.go
@@ -0,0 +1,35 @@
+// +build go1.7
+
+package redis
+
+import (
+ "context"
+
+ "github.com/go-redis/redis/internal/pool"
+)
+
+type baseClient struct {
+ connPool pool.Pooler
+ opt *Options
+
+ process func(Cmder) error
+ onClose func() error // hook called when client is closed
+
+ ctx context.Context
+}
+
+func (c *Client) Context() context.Context {
+ if c.ctx != nil {
+ return c.ctx
+ }
+ return context.Background()
+}
+
+func (c *Client) WithContext(ctx context.Context) *Client {
+ if ctx == nil {
+ panic("nil context")
+ }
+ c2 := c.copy()
+ c2.ctx = ctx
+ return c2
+}