Documentation ¶
Index ¶
- type Config
- type ConfigParams
- type Redis
- func (r *Redis) Do(lg log.FieldLogger, command string, args ...interface{}) (interface{}, error)
- func (r *Redis) FlushAll() error
- func (r *Redis) GetName() string
- func (r *Redis) GetPool() *redis.Pool
- func (r *Redis) HDel(key string, fields ...string) error
- func (r *Redis) HGet(key, field string) ([]byte, error)
- func (r *Redis) HSet(name, field, value string) error
- func (r *Redis) LIndex(key string, index int64) (string, error)
- func (r *Redis) LPop(key string) ([]byte, error)
- func (r *Redis) LRem(key string, count int64, val string) error
- func (r *Redis) PingPongTest() error
- func (r *Redis) RPush(key string, args ...string) error
- func (r *Redis) SAdd(key string, members ...string) error
- func (r *Redis) Shutdown()
- func (r *Redis) ZAdd(key string, member string, score int64) error
- func (r *Redis) ZRange(key string, start int64, stop int64) ([]string, error)
- func (r *Redis) ZRem(key string, member string) error
- func (r *Redis) ZRemByScore(key string, score string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Do `FLUSHALL` redis command at the beginning FlushAll bool `mapstructure:"flush"` Host string `mapstructure:"host"` Port string `mapstructure:"port"` Password string `mapstructure:"password"` DB int `mapstructure:"db"` // Redigo param's // Maximum number of idle connections in the pool. MaxIdle int `mapstructure:"max_idle"` // Maximum number of connections allocated by the pool at a given time. // When zero, there is no limit on the number of connections in the pool. MaxActive int `mapstructure:"max_Active"` // Close connections after remaining idle for this duration. If the value // is zero, then idle connections are not closed. Applications should set // the timeout to a value less than the server's timeout. IdleTimeout time.Duration `mapstructure:"IdleTimeout"` // If Wait is true and the pool is at the MaxActive limit, then Get() waits // for a connection to be returned to the pool before returning. Wait bool `mapstructure:"wait"` // Close connections older than this duration. If the value is zero, then // the pool does not close connections based on age. MaxConnLifetime time.Duration `mapstructure:"max_conn_life_time"` // TestOnBorrow() is an optional application supplied function for checking // the health of an idle connection before the connection is used again by // the application. Argument t is the time that the connection was returned // to the pool. If the function returns an error, then the connection is // closed. TestOnBorrowTime time.Duration `mapstructure:"test_on_borrow_time"` }
type ConfigParams ¶
type ConfigParams = map[string]interface{}
type Redis ¶
type Redis struct { Name string // Name DB (better uniq id in program) // contains filtered or unexported fields }
func NewRedisDB ¶
func NewRedisDB(config ConfigParams, lg log.FieldLogger) (*Redis, error)
func (*Redis) Do ¶
func (r *Redis) Do(lg log.FieldLogger, command string, args ...interface{}) (interface{}, error)
func (*Redis) PingPongTest ¶
Click to show internal directories.
Click to hide internal directories.