AuthInfo: Revert #81013. Fix cache invalidation (#81050)

* Revert "Auth: Revert "Auth: Cache Auth Info" (#81013)"

This reverts commit ce84f7c540.

* fix cache invalidation during user takeover

* fix incomplete test
This commit is contained in:
Jo
2024-01-23 15:26:38 +01:00
committed by GitHub
parent 8ff4e488d9
commit 9f5a8bf926
4 changed files with 185 additions and 16 deletions
+10 -1
View File
@@ -3,6 +3,7 @@ package remotecache
import (
"context"
"crypto/tls"
"errors"
"fmt"
"strconv"
"strings"
@@ -93,7 +94,15 @@ func (s *redisStorage) Set(ctx context.Context, key string, data []byte, expires
// GetByteArray returns the value as byte array
func (s *redisStorage) Get(ctx context.Context, key string) ([]byte, error) {
return s.c.Get(ctx, key).Bytes()
item, err := s.c.Get(ctx, key).Bytes()
if err != nil {
if errors.Is(err, redis.Nil) {
return nil, ErrCacheItemNotFound
}
return nil, err
}
return item, nil
}
// Delete delete a key from session.