1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
| package redisstore
|
| import (
| "apsClient/pkg/redisx"
| "context"
| "time"
| )
|
| type JWT struct {
| PreKey string
| Context context.Context
| }
|
| func NewJWT() *JWT {
| return &JWT{
| PreKey: "JWT_",
| }
| }
|
| func (rs *JWT) UseWithCtx(ctx context.Context) *JWT {
| rs.Context = ctx
| return rs
| }
|
| func (rs *JWT) Set(id string, value string, exp time.Duration) error {
| return redisx.GetRedisClient().Set(rs.Context, rs.PreKey+id, value, exp).Err()
| }
|
| func (rs *JWT) Get(id string) (string, error) {
| return redisx.GetRedisClient().Get(rs.Context, rs.PreKey+id).Result()
| }
|
|