session provider에도 touch 추가
This commit is contained in:
@ -77,6 +77,24 @@ func (p *provider_mongo) Query(pk string) (*Authorization, error) {
|
||||
return &auth, err
|
||||
}
|
||||
|
||||
func (p *provider_mongo) Touch(pk string) (bool, error) {
|
||||
sk := publickey_to_storagekey(publickey(pk))
|
||||
worked, _, err := p.mongoClient.Update(session_collection_name, bson.M{
|
||||
"key": sk,
|
||||
}, bson.M{
|
||||
"$currentDate": bson.M{
|
||||
"_ts": bson.M{"$type": "date"},
|
||||
},
|
||||
}, options.Update().SetUpsert(false))
|
||||
|
||||
if err != nil {
|
||||
logger.Println("provider Touch :", err)
|
||||
return false, err
|
||||
}
|
||||
|
||||
return worked, nil
|
||||
}
|
||||
|
||||
type consumer_mongo struct {
|
||||
consumer_common[*sessionMongo]
|
||||
ids map[primitive.ObjectID]storagekey
|
||||
|
||||
Reference in New Issue
Block a user