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 am using apollo in memory LRU caching along with RESTDataSource. This works fine in case of 200 response where the DS caches the response. But in case of any API error, the RESTDataSource is still caching the response. How can I disable the cache or set the TTL to 0 in case of an error?
This is not well enough documented, but this is working as intended. RESTDataSource has two levels of caching: one which caches the response to a particular HTTP method within a single operation's execution, and one that writes to the shared cache. The second cache pays attention to HTTP error response codes; the first does not, assuming that an operation that returns an error will continue to return the same error if invoked during the same operation. See #1562 (comment) for some discussions of this.
(One could imagine that this is not the ideal behavior, though. RESTDataSource has not been actively maintained for a while but we hope to fix that this year.)
I am using apollo in memory LRU caching along with RESTDataSource. This works fine in case of 200 response where the DS caches the response. But in case of any API error, the RESTDataSource is still caching the response. How can I disable the cache or set the TTL to 0 in case of an error?
The text was updated successfully, but these errors were encountered: