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
As a consumer of an API, I would like the service to publish appropriate cache headers, so that I can leverage caches & minimize resources.
Notes
MongoDB's automatic document versioning seems like a perfect fit for the ETag header. Sophisticated API clients could leverage that by including appropriate If-None-Match headers in their requests.
This should also allow for more effective caching at the server level. Should be able to drop in caching proxies between the API and its clients to reduce load.
Acceptance Criteria
GET requests without an If-None-Match header should include an ETag in the response. This is simply MongoDB's version number.
GET requests with an If-None-Match header should respond "304: Not Modified" if the value of the header matches the current MongoDB version for the requested entity.
HEAD requests with an If-None-Match header should respond "304: Not Modified" if the value of the header matches the current MongoDB version for the requested entity.
Should some simple sanity check should be performed against the client's version number? For example, if the client thinks they have version 4, but version 3 is the latest, should we return some sort of error response or just ignore it?
As for the sanity check we should probably just ignore it. This also reminds me I need to strip the versionKey from incoming and outgoing bodies so people can't tinker with the cache
Summary
As a consumer of an API, I would like the service to publish appropriate cache headers, so that I can leverage caches & minimize resources.
Notes
MongoDB's automatic document versioning seems like a perfect fit for the
ETag
header. Sophisticated API clients could leverage that by including appropriateIf-None-Match
headers in their requests.This should also allow for more effective caching at the server level. Should be able to drop in caching proxies between the API and its clients to reduce load.
Acceptance Criteria
If-None-Match
header should include an ETag in the response. This is simply MongoDB's version number.If-None-Match
header should respond "304: Not Modified" if the value of the header matches the current MongoDB version for the requested entity.If-None-Match
header should respond "304: Not Modified" if the value of the header matches the current MongoDB version for the requested entity.References
The text was updated successfully, but these errors were encountered: