You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
480 B
21 lines
480 B
package wechatunion
|
|
|
|
import (
|
|
"fmt"
|
|
"gopkg.in/dtapps/go-library.v3/utils/goredis"
|
|
"time"
|
|
)
|
|
|
|
func (app *App) GetAccessTokenRDb() string {
|
|
cacheName := fmt.Sprintf("wechat_access_token:%v", app.AppId)
|
|
redis := goredis.App{
|
|
Rdb: app.RDb,
|
|
}
|
|
newCache := redis.NewSimpleStringCache(redis.NewStringOperation(), time.Second*7000)
|
|
newCache.DBGetter = func() string {
|
|
token := app.AuthGetAccessToken()
|
|
return token.Result.AccessToken
|
|
}
|
|
return newCache.GetCache(cacheName)
|
|
}
|