Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apikey: cache policy info lookup & last usage updates #3291

Merged
merged 4 commits into from
Sep 21, 2023

Conversation

mastercactapus
Copy link
Member

Description:
This PR adds a cache for API key policy info and last-usage updates.

This ensures that last-used info isn't updated more than once per minute (per instance). The policy cache ensures that repeated use of the same key doesn't require fetching and parsing the policy JSON for each request.

Additionally, invalid keys (that otherwise have a valid signature) are put in a negative cache. This means when a key is deleted, only the first request will require a DB lookup and subsequent requests from the same key will be rejected immediately.

Which issue(s) this PR fixes:
Part of #3007

Copy link
Collaborator

@allending313 allending313 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mastercactapus mastercactapus merged commit b25e705 into master Sep 21, 2023
6 checks passed
@mastercactapus mastercactapus deleted the gql-key-policy-cache branch September 21, 2023 19:18
allending313 pushed a commit that referenced this pull request Sep 27, 2023
* cache policy and rate-limit last used update

* comments

* fix comments

* remove error return (no possible err)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants