redisx

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HostDev     = "127.0.0.1:6379"
	PasswordDev = "123456"

	HostProd     = "127.0.0.1:6379"
	PasswordProd = "123456"
)
View Source
const (
	RedisPoolMaxIdle     = 100
	RedisPoolMaxActive   = 10000
	RedisPoolIdleTimeout = 1
)
View Source
const (
	EnvOffline = "offline"
	EnvOnline  = "online"
)
View Source
const ExpireTime = 300

Variables

View Source
var (
	RedisClient   *redis.Pool
	RedisHost     string
	RedisPassword string
	Env           string
	RedisDB       int
)

Functions

func Delete

func Delete(context *gin.Context, key string) error

func Expire

func Expire(context *gin.Context, key string, expire int64) error

func Get

func Get(context context.Context, key string) (string, error)

func GetBit

func GetBit(context *gin.Context, key string, offset int64) (int64, error)

func Incr

func Incr(context *gin.Context, key string) error

func InitRedisByConf

func InitRedisByConf(conf *RedisConfig, env string)

func ListAll

func ListAll(context *gin.Context, key string) ([]interface{}, error)

func RedisSetup

func RedisSetup(ctx context.Context)

func Set

func Set(ctx context.Context, key, val string, expire int64) error

func SetBit

func SetBit(context *gin.Context, key string, val, offset int64) error

func SetDefaultRedisConf

func SetDefaultRedisConf(config *RedisConfig, env string)

func SetV2

func SetV2(context *gin.Context, key, val string) error

func Setup

func Setup(ctx context.Context)

func SetupByHost

func SetupByHost(host, password string)

Types

type RedisConfig

type RedisConfig struct {
	RedisHost            string
	RedisPassword        string
	RedisPoolMaxIdle     int
	RedisPoolMaxActive   int
	RedisPoolIdleTimeout int
}

func GetRedisConf

func GetRedisConf(env string) (conf RedisConfig)

func GetRedisConfV2

func GetRedisConfV2() (redisConf RedisConfig)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL