Skip to content
New issue

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

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

Already on GitHub? # to your account

Allow batch lookups #109

Open
ruurtjan opened this issue Nov 21, 2022 · 1 comment
Open

Allow batch lookups #109

ruurtjan opened this issue Nov 21, 2022 · 1 comment

Comments

@ruurtjan
Copy link

Many HTTP APIs have a batch endpoint. This allows multiple values to be requested with a single HTTP call.

This doesn't work well with ZIO-cache right now, as there is no way to look up multiple values at once.

HTTP endpoints are prime targets for caching, since network overhead is usually significant. So I think support for this use case would be a great addition to ZIO-cache.

I'm not sure what the best interface for this would be, but ideally, it would:

  • Use cached values for keys already present in the cache;
  • Call the user-defined batch function with the remaining keys (if any);
  • Add new entries to the cache;
  • Enforce at the type level that the user-defined batch function returns a value for every key.
@regiskuckaertz
Copy link
Member

I actually had the same idea than you and thought that half of your use case is already addressed by zio-query, but it lacks the caching part!

zio/zio-query#378

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants