Documentation ¶
Index ¶
- type Client
- func (c *Client) Append(key string, value string) (int64, error)
- func (c *Client) Close() error
- func (c *Client) Decr(key string) (int64, error)
- func (c *Client) DecrBy(key string, decrement int64) (int64, error)
- func (c *Client) DecrByFloat(key string, decrement float64) (float64, error)
- func (c *Client) Del(keys ...string) (int64, error)
- func (c *Client) Echo(message string) (string, error)
- func (c *Client) Exists(keys ...string) (bool, error)
- func (c *Client) Expire(key string, timeout int64) (bool, error)
- func (c *Client) FlushAll() error
- func (c *Client) FlushDb() error
- func (c *Client) Get(key string) (string, bool, error)
- func (c *Client) GetConnection() redis.Conn
- func (c *Client) GetRange(key string, start int, end int) (string, error)
- func (c *Client) HDecr(key string, field string) (int64, error)
- func (c *Client) HDecrBy(key string, field string, decrement int64) (int64, error)
- func (c *Client) HDecrByFloat(key string, field string, decrement float64) (float64, error)
- func (c *Client) HDel(key string, fields ...string) (int64, error)
- func (c *Client) HExists(key string, field string) (bool, error)
- func (c *Client) HGet(key string, field string) (string, bool, error)
- func (c *Client) HGetAll(key string) (map[string]string, error)
- func (c *Client) HIncr(key string, field string) (int64, error)
- func (c *Client) HIncrBy(key string, field string, increment int64) (int64, error)
- func (c *Client) HIncrByFloat(key string, field string, increment float64) (float64, error)
- func (c *Client) HKeys(key string) ([]string, error)
- func (c *Client) HScan(key string, startIndex int64, pattern string) (int64, []string, error)
- func (c *Client) HSet(key string, field string, value string) (bool, error)
- func (c *Client) Incr(key string) (int64, error)
- func (c *Client) IncrBy(key string, increment int64) (int64, error)
- func (c *Client) IncrByFloat(key string, increment float64) (float64, error)
- func (c *Client) Info() (string, error)
- func (c *Client) Keys(pattern string) ([]string, error)
- func (c *Client) Ping() (string, error)
- func (c *Client) Scan(startIndex int64, pattern string) (int64, []string, error)
- func (c *Client) Set(key string, value string) (bool, error)
- func (c *Client) SetEx(key string, value string, timeout int64) (bool, error)
- func (c *Client) SetNx(key string, value string) (bool, error)
- func (c *Client) SetRange(key string, start int, value string) (int64, error)
- type Options
- func (o *Options) GetAddress() string
- func (o *Options) GetConnectTimeout() time.Duration
- func (o *Options) GetConnectionIdleTimeout() time.Duration
- func (o *Options) GetConnectionMaxActive() int
- func (o *Options) GetConnectionMaxIdle() int
- func (o *Options) GetConnectionWait() bool
- func (o *Options) GetDatabase() int
- func (o *Options) GetHost() string
- func (o *Options) GetNetwork() string
- func (o *Options) GetPassword() string
- func (o *Options) GetPort() int
- func (o *Options) GetReadTimeout() time.Duration
- func (o *Options) GetTestOnBorrowPeriod() time.Duration
- func (o *Options) GetTlsConfig() *tls.Config
- func (o *Options) GetTlsSkipVerify() bool
- func (o *Options) GetWriteTimeout() time.Duration
- type SentinelOptions
- func (o *SentinelOptions) GetAddresses() []string
- func (o *SentinelOptions) GetConnectTimeout() time.Duration
- func (o *SentinelOptions) GetConnectionIdleTimeout() time.Duration
- func (o *SentinelOptions) GetConnectionMaxActive() int
- func (o *SentinelOptions) GetConnectionMaxIdle() int
- func (o *SentinelOptions) GetConnectionWait() bool
- func (o *SentinelOptions) GetDatabase() int
- func (o *SentinelOptions) GetMasterName() string
- func (o *SentinelOptions) GetNetwork() string
- func (o *SentinelOptions) GetPassword() string
- func (o *SentinelOptions) GetReadTimeout() time.Duration
- func (o *SentinelOptions) GetTestOnBorrowPeriod() time.Duration
- func (o *SentinelOptions) GetTlsConfig() *tls.Config
- func (o *SentinelOptions) GetTlsSkipVerify() bool
- func (o *SentinelOptions) GetWriteTimeout() time.Duration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client redis client
func DefaultClient ¶
func DefaultClient() *Client
DefaultClient returns a client with default options
func SetupClient ¶
SetupClient returns a client with provided options
func SetupSentinelClient ¶
func SetupSentinelClient(options *SentinelOptions) *Client
SetupSentinelClient returns a client with provided options
func (*Client) DecrByFloat ¶
DecrByFloat decrements the key's value by the decrement provided
func (*Client) GetConnection ¶
GetConnection gets a connection from the pool
func (*Client) HDecrByFloat ¶
HDecrByFloat decrements the key's field's value by the decrement provided
func (*Client) HIncrByFloat ¶
HIncrByFloat increments the key's field's value by the increment provided
func (*Client) IncrByFloat ¶
IncrByFloat increments the key's value by the increment provided
type Options ¶
type Options struct { Host string Port int Password string Database int Network string ConnectTimeout time.Duration WriteTimeout time.Duration ReadTimeout time.Duration ConnectionIdleTimeout time.Duration ConnectionMaxIdle int ConnectionMaxActive int ConnectionWait bool TlsConfig *tls.Config TlsSkipVerify bool TestOnBorrowPeriod time.Duration }
Options contains redis options
func (*Options) GetConnectTimeout ¶
GetConnectTimeout returns connect timeout
func (*Options) GetConnectionIdleTimeout ¶
GetConnectionIdleTimeout returns connection idle timeout
func (*Options) GetConnectionMaxActive ¶
GetConnectionMaxActive returns connection max active
func (*Options) GetConnectionMaxIdle ¶
GetConnectionMaxIdle returns connection max idle
func (*Options) GetConnectionWait ¶
GetConnectionWait returns connection wait
func (*Options) GetReadTimeout ¶
GetReadTimeout returns read timeout
func (*Options) GetTestOnBorrowPeriod ¶
GetTestOnBorrowPeriod return test on borrow period
func (*Options) GetTlsConfig ¶
GetTlsConfig returns tls config
func (*Options) GetTlsSkipVerify ¶
GetTlsSkipVerify returns tls skip verify
func (*Options) GetWriteTimeout ¶
GetWriteTimeout returns write timeout
type SentinelOptions ¶
type SentinelOptions struct { Addresses []string MasterName string Password string Database int Network string ConnectTimeout time.Duration WriteTimeout time.Duration ReadTimeout time.Duration ConnectionIdleTimeout time.Duration ConnectionMaxIdle int ConnectionMaxActive int ConnectionWait bool TlsConfig *tls.Config TlsSkipVerify bool TestOnBorrowPeriod time.Duration }
SentinelOptions contains redis sentinel options
func (*SentinelOptions) GetAddresses ¶
func (o *SentinelOptions) GetAddresses() []string
GetAddresses returns sentinel address
func (*SentinelOptions) GetConnectTimeout ¶
func (o *SentinelOptions) GetConnectTimeout() time.Duration
GetConnectTimeout returns connect timeout
func (*SentinelOptions) GetConnectionIdleTimeout ¶
func (o *SentinelOptions) GetConnectionIdleTimeout() time.Duration
GetConnectionIdleTimeout returns connection idle timeout
func (*SentinelOptions) GetConnectionMaxActive ¶
func (o *SentinelOptions) GetConnectionMaxActive() int
GetConnectionMaxActive returns connection max active
func (*SentinelOptions) GetConnectionMaxIdle ¶
func (o *SentinelOptions) GetConnectionMaxIdle() int
GetConnectionMaxIdle returns connection max idle
func (*SentinelOptions) GetConnectionWait ¶
func (o *SentinelOptions) GetConnectionWait() bool
GetConnectionWait returns connection wait
func (*SentinelOptions) GetDatabase ¶
func (o *SentinelOptions) GetDatabase() int
GetDatabase returns database
func (*SentinelOptions) GetMasterName ¶
func (o *SentinelOptions) GetMasterName() string
GetMasterName returns master name
func (*SentinelOptions) GetNetwork ¶
func (o *SentinelOptions) GetNetwork() string
GetNetwork returns network
func (*SentinelOptions) GetPassword ¶
func (o *SentinelOptions) GetPassword() string
GetPassword returns password
func (*SentinelOptions) GetReadTimeout ¶
func (o *SentinelOptions) GetReadTimeout() time.Duration
GetReadTimeout returns read timeout
func (*SentinelOptions) GetTestOnBorrowPeriod ¶
func (o *SentinelOptions) GetTestOnBorrowPeriod() time.Duration
GetTestOnBorrowPeriod return test on borrow period
func (*SentinelOptions) GetTlsConfig ¶
func (o *SentinelOptions) GetTlsConfig() *tls.Config
GetTlsConfig returns tls config
func (*SentinelOptions) GetTlsSkipVerify ¶
func (o *SentinelOptions) GetTlsSkipVerify() bool
GetTlsSkipVerify returns tls skip verify
func (*SentinelOptions) GetWriteTimeout ¶
func (o *SentinelOptions) GetWriteTimeout() time.Duration
GetWriteTimeout returns write timeout