uniugm/admin/lib/cache/cache_redis.go

24 lines
388 B
Go
Raw Permalink Normal View History

2025-05-09 18:28:15 +08:00
package cache
import (
"github.com/redis/go-redis/v9"
)
type RedisCache struct {
rawClient *redis.Client
}
func NewRedisClient(addr string, dbNo int, user, pass string) (*RedisCache, error) {
opt := &redis.Options{
Addr: addr,
DB: dbNo,
Username: user,
Password: pass,
}
client := redis.NewClient(opt)
c := &RedisCache{
rawClient: client,
}
return c, nil
}