* Adding Reaction store cache layer example * Implementing reaction store in new caching system. * Redis for reaction store * Adding redis library * Adding invalidation for DeleteAllWithEmojiName and other minor enhancements
36 строки
537 B
Go
36 строки
537 B
Go
// +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
|
|
}
|