Caching option for all evaluators of all phases #247
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rolls out the same idea of #239 to all phases, i.e. any resulting object once evaluated by any evaluator can now be cached, and the cached value reused automatically by Authorino whenever the user-defined cache key for that particular evaluator repeats, until the cache entry expires.
Effectively, this change enables, e.g.:
You will not want to enable caching in evaluators whose execution is as cheap as accessing the cache, but for the expensive ones, we believe this feature can be very useful to speed up external authorization.
The PR also renames the env variable
METADATA_CACHE_SIZE
(introduced in #239) to the more genericEVALUATOR_CACHE_SIZE
.Likely, this will have to be improved in the future, to provide finer-grained configuration for the different use cases for the cache.
Verification steps
Build and deploy based on this branch:
make local-setup kubectl -n authorino port-forward deployment/envoy 8000:8000 &
Apply the AuthConfig:
Send requests:
/hello
/hello
again before the cache entry expires (60 seconds from the first request sent to this path)/hello
again after the cache entry expires (60 seconds from the first request sent to this path)Closes #20