- 
                Notifications
    
You must be signed in to change notification settings  - Fork 23
 
Description
We are actively using Apollo, and the Rest Data Source with Redis as our overall cache for some legacy APIs.  We have quite a few GET Api's that we never want cached, that return correct no-cache headers, and to be explicit we have also set the cacheOptions ttl to zero.
However, we can still see a lot of un-necessary MGET url in our logs, due to the code:
https://github.com/apollographql/datasource-rest/blob/main/src/HTTPCache.ts#L78
This code means that it will always check the cache for every request that is not a HEAD.
Would you consider a PR that if the ttl has been manually set to zero, it should not check the cache for values, or perhaps an additional explicit value so as not to break existing behaviour? Something along the lines of:
const neverCache = !requestOpts.cache?.cacheOptions?.ttl || !requestOpts.cache?.cacheOptions?.neverCache;
if (neverCache) {
    return { response: await this.httpFetch(urlString, requestOpts) };
}
This would avoud (for us at least) hundreds of thousands of pointless MGET requests to our cache!