Documentation ¶
Index ¶
- Constants
- func Marshal(value interface{}) ([]byte, error)
- func UnMarshal(data []byte, value interface{}) error
- type Cache
- type Client
- func (c *Client) Close()
- func (c *Client) Decr(key string) (int, error)
- func (c *Client) DecrBy(key string, count int) (int, error)
- func (c *Client) Del(key string) error
- func (c *Client) Get(key string, value interface{}) error
- func (c *Client) GetCounter(key string) (int, error)
- func (c *Client) GetOrSet(key string, handler Handle, value interface{}, expire int) (interface{}, error)
- func (c *Client) Incr(key string) (int, error)
- func (c *Client) IncrBy(key string, count int) (int, error)
- func (c *Client) Lock(key string) bool
- func (c *Client) LockWithTimeOut(key string, timeout int64) bool
- func (c *Client) RealKey(key string) string
- func (c *Client) Set(key string, source interface{}, expire int) error
- func (c *Client) Unlock(key string) error
- type Counter
- type Handle
- type Locker
- type Manager
- type Options
- type RedisStore
Constants ¶
View Source
const LockKeyPrefix = "gold.lock"
View Source
const RetryTime = 5
View Source
const TimeOut = 100 * time.Millisecond
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type Options ¶
type Options struct { Prefix string `json:"prefix" yaml:"prefix" mapstructure:"prefix"` Address string `json:"address" mapstructure:"address"` Password string `json:"password" json:"password" mapstructure:"password"` DB int `json:"db" yaml:"db" mapstructure:"db"` MaxIdle int `json:"max_idle" yaml:"max_idle" mapstructure:"max_idle"` MaxActive int `json:"max_active" yaml:"max_active" mapstructure:"max_active"` Wait bool `json:"wait" yaml:"wait" structure:"wait"` // 单位为秒 IdleTimeout int `json:"idle_timeout" yaml:"idle_timeout" structure:"idle_timeout"` // 单位为秒 Timeout int `json:"timeout" yaml:"timeout" mapstructure:"timeout"` }
type RedisStore ¶
type RedisStore interface { Marshal() ([]byte, error) Unmarshal([]byte) (RedisStore, error) }
Click to show internal directories.
Click to hide internal directories.