Documentation
¶
Overview ¶
Package cache implements cache utility functions.
Usage
cache.Init(cache.Conf{Address: "10.105.99.81:6379"}) cache.Set("key-a", "value-a") v, _ := cache.Get("key-a") fmt.Println(v)
Index ¶
- func Delete(key string) error
- func Exists(key string) bool
- func Expire(key string, second int) error
- func Get(key string) (string, error)
- func HDelete(key, field string) error
- func HExists(key, field string) bool
- func HGet(key, field string) (string, error)
- func HLen(key string) (int, error)
- func HSet(key, field, value string) error
- func Init(conf Conf)
- func SGet(key string, out interface{}) error
- func SSet(key string, value interface{}) error
- func Set(key, value string) error
- type Conf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HExists ¶
HExists according to the key to determine whether the value of the dictionary type exists.
Types ¶
type Conf ¶
type Conf struct { Address string Password string // Maximum number of idle connections in the pool. MaxIdle int // 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 // 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 }
Conf cache configuration.
Click to show internal directories.
Click to hide internal directories.