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.
20 lines
462 B
20 lines
462 B
3 years ago
|
package wechatminiprogram
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"gopkg.in/dtapps/go-library.v3/utils/goredis"
|
||
|
)
|
||
|
|
||
|
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(), 7000)
|
||
|
newCache.DBGetter = func() string {
|
||
|
token, _ := app.AuthGetAccessToken()
|
||
|
return token.AccessToken
|
||
|
}
|
||
|
return newCache.GetCache(cacheName)
|
||
|
}
|