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

Interquery http.send cache - Add provision to exclude/include headers from cache key #6642

Open
rudrakhp opened this issue Mar 22, 2024 · 3 comments · May be fixed by #6675
Open

Interquery http.send cache - Add provision to exclude/include headers from cache key #6642

rudrakhp opened this issue Mar 22, 2024 · 3 comments · May be fixed by #6675

Comments

@rudrakhp
Copy link
Contributor

What is the underlying problem you're trying to solve?

There are usecases where we need to cache responses but the requests have guaranteed unique headers (example: trace-id) that prevent us from using the inter query cache functionality.

Describe the ideal solution

The http.send built in must support a header exclusion list that are not matched when looking up entries from inter query cache. Not sure if it's possible today.

Describe a "Good Enough" solution

Same as the ideal solution described above.

Additional Context

N/A

@ashutosh-narkar
Copy link
Member

Currently the entire request object is used as the cache key. It would be interesting to look into how that behavior can be controlled via a new param maybe. So by default the entire object is used as a key and we could specify a list of fields that won't be part of the key generation.

@ashutosh-narkar ashutosh-narkar added this to Backlog in Open Policy Agent via automation Apr 2, 2024
@ashutosh-narkar
Copy link
Member

@rudrakhp if you'd like to contribute this feature feel free to do so.

@rudrakhp
Copy link
Contributor Author

rudrakhp commented Apr 4, 2024

@ashutosh-narkar Although the solution is not ideal, the above PR has changes that suffices our usecase at the moment.
Eg: If there is a change in the exclusion list, a new cache key is generated which leads to a cache miss. A more optimised solution would be to check if the new exclusion list is a subset of the current one and still serve from cache.
Let me know if it looks good to you. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Open Policy Agent
  
Backlog
Development

Successfully merging a pull request may close this issue.

2 participants