session provider에도 touch 추가
This commit is contained in:
@ -87,6 +87,20 @@ func (p *provider_redis) Query(pk string) (*Authorization, error) {
|
||||
return &auth, nil
|
||||
}
|
||||
|
||||
func (p *provider_redis) Touch(pk string) (bool, error) {
|
||||
sk := publickey_to_storagekey(publickey(pk))
|
||||
ok, err := p.redisClient.Expire(p.ctx, string(sk), p.ttl).Result()
|
||||
if err == redis.Nil {
|
||||
// 이미 만료됨
|
||||
return false, nil
|
||||
} else if err != nil {
|
||||
logger.Println("consumer Touch :", err)
|
||||
return false, err
|
||||
}
|
||||
|
||||
return ok, nil
|
||||
}
|
||||
|
||||
type consumer_redis struct {
|
||||
consumer_common[*sessionRedis]
|
||||
redisClient *redis.Client
|
||||
|
||||
Reference in New Issue
Block a user