1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 00:22:41 +08:00

更新redis

This commit is contained in:
2023-10-13 10:52:36 +08:00
parent e83db7daee
commit d1c269ed90
8 changed files with 48 additions and 42 deletions

12
cache/cache_test.go vendored
View File

@ -6,6 +6,8 @@ import (
"sync/atomic"
"testing"
"time"
"github.com/charlienet/go-mixed/redis"
)
var (
@ -60,7 +62,9 @@ func TestMemCache(t *testing.T) {
}
func TestDistributedCache(t *testing.T) {
c := NewRedis(RedisConfig{Addrs: []string{"192.168.2.222:6379"}, DB: 6, Password: "123456", Prefix: "abcdef"})
c := NewRedis(redis.New(&redis.ReidsOption{
Addrs: []string{"192.168.2.222:6379"}, DB: 6, Password: "123456", Prefix: "abcdef",
}))
ctx := context.Background()
if err := c.Ping(ctx); err != nil {
@ -134,7 +138,11 @@ func load() (any, error) {
func buildCache() *Cache {
c, err := New(
WithFreeCache(10*1024*1024),
WithRedis(RedisConfig{Addrs: []string{"192.168.2.222:6379"}, DB: 6, Password: "123456"}))
WithRedis(redis.New(&redis.ReidsOption{
Addrs: []string{"192.168.2.222:6379"},
DB: 6,
Password: "123456",
})))
if err != nil {
panic(err)