|
|
@ -3,11 +3,12 @@ package cache
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"bytes"
|
|
|
|
"encoding/gob"
|
|
|
|
"encoding/gob"
|
|
|
|
"github.com/cloudreve/Cloudreve/v4/pkg/conf"
|
|
|
|
|
|
|
|
"github.com/cloudreve/Cloudreve/v4/pkg/logging"
|
|
|
|
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/cloudreve/Cloudreve/v4/pkg/conf"
|
|
|
|
|
|
|
|
"github.com/cloudreve/Cloudreve/v4/pkg/logging"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/gomodule/redigo/redis"
|
|
|
|
"github.com/gomodule/redigo/redis"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -45,8 +46,7 @@ func deserializer(value []byte) (any, error) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// NewRedisStore 创建新的redis存储
|
|
|
|
// NewRedisStore 创建新的redis存储
|
|
|
|
func NewRedisStore(l logging.Logger, size int, configProvider conf.ConfigProvider) *RedisStore {
|
|
|
|
func NewRedisStore(l logging.Logger, size int, redisConfig *conf.Redis) *RedisStore {
|
|
|
|
redisConfig := configProvider.Redis()
|
|
|
|
|
|
|
|
return &RedisStore{
|
|
|
|
return &RedisStore{
|
|
|
|
pool: &redis.Pool{
|
|
|
|
pool: &redis.Pool{
|
|
|
|
MaxIdle: size,
|
|
|
|
MaxIdle: size,
|
|
|
@ -67,7 +67,7 @@ func NewRedisStore(l logging.Logger, size int, configProvider conf.ConfigProvide
|
|
|
|
redis.DialDatabase(db),
|
|
|
|
redis.DialDatabase(db),
|
|
|
|
redis.DialPassword(redisConfig.Password),
|
|
|
|
redis.DialPassword(redisConfig.Password),
|
|
|
|
redis.DialUsername(redisConfig.User),
|
|
|
|
redis.DialUsername(redisConfig.User),
|
|
|
|
redis.DialUseTLS(redisConfig.UseSSL),
|
|
|
|
redis.DialUseTLS(redisConfig.UseTLS),
|
|
|
|
redis.DialTLSSkipVerify(redisConfig.TLSSkipVerify),
|
|
|
|
redis.DialTLSSkipVerify(redisConfig.TLSSkipVerify),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|