Cache: Refactor cache clients to use byte array (#62930)

Signed-off-by: bergquist <carl.bergquist@gmail.com>
This commit is contained in:
Carl Bergquist
2023-02-08 10:30:20 +01:00
committed by GitHub
parent 2804acd264
commit b88206d98f
7 changed files with 56 additions and 32 deletions

View File

@@ -171,8 +171,8 @@ func (ks *keySetHTTP) getJWKS(ctx context.Context) (keySetJWKS, error) {
var jwks keySetJWKS
if ks.cacheExpiration > 0 {
if val, err := ks.cache.Get(ctx, ks.cacheKey); err == nil {
err := json.Unmarshal(val.([]byte), &jwks)
if val, err := ks.cache.GetByteArray(ctx, ks.cacheKey); err == nil {
err := json.Unmarshal(val, &jwks)
return jwks, err
}
}
@@ -200,7 +200,7 @@ func (ks *keySetHTTP) getJWKS(ctx context.Context) (keySetJWKS, error) {
}
if ks.cacheExpiration > 0 {
err = ks.cache.Set(ctx, ks.cacheKey, jsonBuf.Bytes(), ks.cacheExpiration)
err = ks.cache.SetByteArray(ctx, ks.cacheKey, jsonBuf.Bytes(), ks.cacheExpiration)
}
return jwks, err
}