-
Notifications
You must be signed in to change notification settings - Fork 2.7k
refactor(improvement): use secret URI as key for cache and refactor lrucache #12682
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
base: master
Are you sure you want to change the base?
Conversation
|
||
|
||
local function fetch_by_uri(secret_uri) | ||
local function fetch_by_uri_secret(secret_uri) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using a new local function with same name here https://github.com/apache/apisix/pull/12682/files#diff-50c5241a560560f8d61637b60caa3e9f2dce27139863265cfa8ffb63a8537803R212 so this function name got changed to be more specific to avoid conflict.
Secret module changes: Currently the cache key is the whole conf which is inefficient because multiple conf might be referencing the same secret.
So new requirement is to refactor apisix/secret.lua so that cache key is the url and we only cache the result of fetch(uri) function.
LRUCache module changes: Allow LRU cache to have different underlying cache for success and failure, so that each of them can be configured differently.
NOTE: The fetch_secrets() API is simplified to not take key and version from the caller because they were redundant anyways and moreover now the key is resolved internally.
Checklist