Documentation ¶
Index ¶
- Variables
- func SetDefaultRedisConfig()
- type Component
- type Config
- type RXRedisCache
- func (rc *RXRedisCache) DecrBy(key string, num int64) (interface{}, error)
- func (rc *RXRedisCache) Delete(key string) error
- func (rc *RXRedisCache) Get(key string) (interface{}, error)
- func (rc *RXRedisCache) GetObject(key string, ref interface{}) error
- func (rc *RXRedisCache) GetString(key string) (string, error)
- func (rc *RXRedisCache) IncrBy(key string, num int64, timeOut int) (interface{}, error)
- func (rc *RXRedisCache) IsExist(key string) bool
- func (rc *RXRedisCache) Keys(expression string) (interface{}, error)
- func (rc *RXRedisCache) LOCK(key, requestID string, timeOut time.Duration) error
- func (rc *RXRedisCache) LPop(key string) (interface{}, error)
- func (rc *RXRedisCache) LPush(key string, value interface{}) error
- func (rc *RXRedisCache) Put(key string, value interface{}) error
- func (rc *RXRedisCache) PutNX(key string, value interface{}) (bool, error)
- func (rc *RXRedisCache) PutWithExpire(key string, value interface{}, expire interface{}) error
- func (rc *RXRedisCache) UNLOCK(key, requestID string, timeOut time.Duration) error
Constants ¶
This section is empty.
Variables ¶
var ElementKey = micro.ElementKey("RedisComponent")
ElementKey is ElementKey for redis
Functions ¶
func SetDefaultRedisConfig ¶
func SetDefaultRedisConfig()
SetDefaultRedisConfig Set the default configuration information for the Redis non-relational cache database
Types ¶
type Component ¶
type Component struct { micro.EmptyComponent // contains filtered or unexported fields }
Component is Component for redis
type Config ¶
type Config struct { Address string `toml:"address"` DB int `toml:"db"` Password string `toml:"password"` MaxIdle int `toml:"maxIdle"` MaxActive int `toml:"maxActive"` IdleTimeout int `toml:"idleTimeout"` ConnTimeout int `toml:"connTimeout"` Wait bool `toml:"wait"` MaxConnLifetime int `toml:"maxConnLifetime"` }
Config redis configuration
func GetRedisConfig ¶
func GetRedisConfig() *Config
GetRedisConfig Get the configuration information of the Redis non-relational cache database
type RXRedisCache ¶
RXRedisCache implement RXCache
func InitRedisPool ¶
func InitRedisPool(config Config) (*RXRedisCache, error)
InitRedisPool init redis connection pool
func (*RXRedisCache) DecrBy ¶
func (rc *RXRedisCache) DecrBy(key string, num int64) (interface{}, error)
DecrBy redis key The stored value minus the specified decrement
func (*RXRedisCache) Delete ¶
func (rc *RXRedisCache) Delete(key string) error
Delete Redis DEL Command to delete an existing key. Non-existent keys will be ignored.
func (*RXRedisCache) Get ¶
func (rc *RXRedisCache) Get(key string) (interface{}, error)
Get Redis Get The command is used to get the value of the specified key. If the key does not exist, return nil. If the value stored in the key is not a string type, return an error.
func (*RXRedisCache) GetObject ¶
func (rc *RXRedisCache) GetObject(key string, ref interface{}) error
GetObject redis get object
func (*RXRedisCache) GetString ¶
func (rc *RXRedisCache) GetString(key string) (string, error)
GetString Get The command is used to get the value of the specified key and convert it to a string
func (*RXRedisCache) IncrBy ¶
func (rc *RXRedisCache) IncrBy(key string, num int64, timeOut int) (interface{}, error)
IncrBy redis set key storage limit and timeout.
func (*RXRedisCache) IsExist ¶
func (rc *RXRedisCache) IsExist(key string) bool
IsExist Redis EXISTS Command to check if the given key exists.
func (*RXRedisCache) Keys ¶
func (rc *RXRedisCache) Keys(expression string) (interface{}, error)
Keys Redis Keys The command is used to find all keys that match the given pattern
func (*RXRedisCache) LOCK ¶
func (rc *RXRedisCache) LOCK(key, requestID string, timeOut time.Duration) error
LOCK redis Lock reply. Unlock."
func (*RXRedisCache) LPop ¶
func (rc *RXRedisCache) LPop(key string) (interface{}, error)
LPop Redis Lpop Command to remove and return the first element of the list.
func (*RXRedisCache) LPush ¶
func (rc *RXRedisCache) LPush(key string, value interface{}) error
LPush Redis Lpush Command to insert one or more values at the beginning of the list.
func (*RXRedisCache) Put ¶
func (rc *RXRedisCache) Put(key string, value interface{}) error
Put redis insert data
func (*RXRedisCache) PutNX ¶
func (rc *RXRedisCache) PutNX(key string, value interface{}) (bool, error)
PutNX Redis Setnx(SET if Not exist)
func (*RXRedisCache) PutWithExpire ¶
func (rc *RXRedisCache) PutWithExpire(key string, value interface{}, expire interface{}) error
PutWithExpire Redis Setex The command sets the value and expiration time for the specified key. If the key already exists, the SETEX command will replace the old value