feat: add cache clear

This commit is contained in:
Lakhan Samani
2023-04-08 18:02:53 +05:30
parent 02c0ebb9c4
commit 428a0be3db
2 changed files with 59 additions and 17 deletions

View File

@@ -42,17 +42,14 @@ func (c *provider) GetUserSession(userId, key string) (string, error) {
func (c *provider) DeleteUserSession(userId, key string) error {
if err := c.store.Del(c.ctx, fmt.Sprintf("%s:%s", userId, constants.TokenTypeSessionToken+"_"+key)).Err(); err != nil {
log.Debug("Error deleting user session from redis: ", err)
fmt.Println("Error deleting user session from redis: ", err, userId, constants.TokenTypeSessionToken, key)
// continue
}
if err := c.store.Del(c.ctx, fmt.Sprintf("%s:%s", userId, constants.TokenTypeAccessToken+"_"+key)).Err(); err != nil {
log.Debug("Error deleting user session from redis: ", err)
fmt.Println("Error deleting user session from redis: ", err, userId, constants.TokenTypeAccessToken, key)
// continue
}
if err := c.store.Del(c.ctx, fmt.Sprintf("%s:%s", userId, constants.TokenTypeRefreshToken+"_"+key)).Err(); err != nil {
log.Debug("Error deleting user session from redis: ", err)
fmt.Println("Error deleting user session from redis: ", err, userId, constants.TokenTypeRefreshToken, key)
// continue
}
return nil