Skip to content

Commit

Permalink
fix: improve caching configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed May 9, 2024
1 parent f6adf0b commit 2373057
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions pipeline/authn/authenticator_oauth2_client_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func (a *AuthenticatorOAuth2ClientCredentials) Config(config json.RawMessage) (*
Cost: func(value interface{}) int64 {
return 1
},
IgnoreInternalCost: true,
})
if err != nil {
return nil, err
Expand Down
6 changes: 5 additions & 1 deletion pipeline/authn/authenticator_oauth2_introspection.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,15 @@ func (a *AuthenticatorOAuth2Introspection) Config(config json.RawMessage) (*Auth
a.logger.Debugf("Creating cache with max cost: %d", c.Cache.MaxCost)
cache, err := ristretto.NewCache(&ristretto.Config{
// This will hold about 1000 unique mutation responses.
NumCounters: 10000,
NumCounters: cost * 10,
// Allocate a max
MaxCost: cost,
// This is a best-practice value.
BufferItems: 64,
Cost: func(value interface{}) int64 {
return 1
},
IgnoreInternalCost: true,
})
if err != nil {
return nil, nil, err
Expand Down

0 comments on commit 2373057

Please sign in to comment.