As a creator of APIs, agents seem scary from an optimization/caching point of view.
I’d rather serve the same request 10,000 (which could be cached) than have 1,000 different agents making requests (which would be hard to cache).
As a creator of APIs, agents seem scary from an optimization/caching point of view.
I’d rather serve the same request 10,000 (which could be cached) than have 1,000 different agents making requests (which would be hard to cache).
Imagine that you could give an app server a formula to combine several API calls, much like you give an SQL server a formula to join and filter tables.
Also, you can easily cache agents by calculating a hash of their source, and call them repeatedly without resending their bodies, much like "prepared statements" work in SQL databases.
Like this: https://gist.github.com/AriaMinaei/69e1a9166e7ffbd61e7f6709d...
That doesn't solve any of the caching worries. If it's not a resource then it's not cacheable.
> This could save round-trips without needing to sacrifice general orthogonal APIs.
Since the inception of HTTP2, a relative large number of requests of cached resources easily beat a relatively small number of requests that are computationally demanding or hit a database.
Edit: Just wrote some pseudo code: https://gist.github.com/AriaMinaei/69e1a9166e7ffbd61e7f6709d...