✨ encapsulate Redis base function
This commit is contained in:
20
core/redis.go
Normal file
20
core/redis.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"github.com/redis/go-redis/v9"
|
||||
"schisandra-cloud-album/global"
|
||||
)
|
||||
|
||||
func InitRedis() {
|
||||
rdb := redis.NewClient(&redis.Options{
|
||||
Addr: global.CONFIG.Redis.Addr(),
|
||||
Password: global.CONFIG.Redis.Password,
|
||||
DB: global.CONFIG.Redis.Db,
|
||||
MaxActiveConns: global.CONFIG.Redis.MaxActive,
|
||||
MaxIdleConns: global.CONFIG.Redis.MaxIdle,
|
||||
PoolSize: global.CONFIG.Redis.PoolSize,
|
||||
MinIdleConns: global.CONFIG.Redis.MinIdle,
|
||||
PoolTimeout: global.CONFIG.Redis.PoolTimeout,
|
||||
})
|
||||
global.REDIS = rdb
|
||||
}
|
Reference in New Issue
Block a user