|
|
@ -2,6 +2,7 @@ package cache
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/conf"
|
|
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/conf"
|
|
|
|
|
|
|
|
"github.com/cloudreve/Cloudreve/v3/pkg/util"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -10,8 +11,6 @@ var Store Driver = NewMemoStore()
|
|
|
|
|
|
|
|
|
|
|
|
// Init 初始化缓存
|
|
|
|
// Init 初始化缓存
|
|
|
|
func Init() {
|
|
|
|
func Init() {
|
|
|
|
//Store = NewRedisStore(10, "tcp", "127.0.0.1:6379", "", "0")
|
|
|
|
|
|
|
|
//return
|
|
|
|
|
|
|
|
if conf.RedisConfig.Server != "" && gin.Mode() != gin.TestMode {
|
|
|
|
if conf.RedisConfig.Server != "" && gin.Mode() != gin.TestMode {
|
|
|
|
Store = NewRedisStore(
|
|
|
|
Store = NewRedisStore(
|
|
|
|
10,
|
|
|
|
10,
|
|
|
@ -21,6 +20,13 @@ func Init() {
|
|
|
|
conf.RedisConfig.DB,
|
|
|
|
conf.RedisConfig.DB,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if conf.SystemConfig.Mode == "slave" {
|
|
|
|
|
|
|
|
err := Store.Sets(conf.OptionOverwrite, "setting_")
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
util.Log().Warning("无法覆盖数据库设置: %s", err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Driver 键值缓存存储容器
|
|
|
|
// Driver 键值缓存存储容器
|
|
|
|