You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking into ways for improving hydra APIs by using cache headers. A first-order recommendation is to use versioned assets and long-lived immutable cache. I think this fits the most common case of API Documentation which remains static at least until the server app is restarted.
To implement this behaviour would require three changes:
First, to add a query string to the documentation header. Possible something like UNIX timestamp
Having experimented with this approach a little I had limited success. The problem with a query string is that this is identified as a different identifier which caused me trouble on the client trying to find the documentation resource.
A different approach I tried was with a shorter cache age and etag. This appears to work nicely
There is no one way to set caching, and APIs may choose not to completely. I was thinking that maybe hydra-box could introduce extension points to plug middleware before the get(api.path) handler? Something like
I'm looking into ways for improving hydra APIs by using cache headers. A first-order recommendation is to use versioned assets and long-lived immutable cache. I think this fits the most common case of API Documentation which remains static at least until the server app is restarted.
To implement this behaviour would require three changes:
First, to add a query string to the documentation header. Possible something like UNIX timestamp
Second,
cache-control
to the API Documentation itselfLastly, to actually serve the triples with all URIs
/api
rewritten to/api?v=123456789
so that client can correctly find it in the representation.This should allow proxies to cache the API documentation.
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: