feat: 公众号登录 共享access_token方案 #3

Merged
wujiefeng merged 3 commits from wfd into master 2025-11-17 11:25:02 +08:00
1 changed files with 23 additions and 0 deletions
Showing only changes of commit 6bdfa4b438 - Show all commits

23
cache/redis.go vendored Normal file
View File

@ -0,0 +1,23 @@
package cache
import "github.com/go-redis/redis"
var (
redisClient *redis.Client = nil
)
func NewRedis() {
addr := "127.0.0.1:6379"
redis.NewClient(&redis.Options{})
redisClient = redis.NewClient(&redis.Options{
Addr: addr,
})
}
func GetRedis() *redis.Client {
if redisClient == nil {
NewRedis()
}
return redisClient
}