Apollo-feature-requests: Bypass cache on RESTDataSource get method

Created on 12 Nov 2018  路  1Comment  路  Source: apollographql/apollo-feature-requests

  • [x] question
  • [x] feature

Hi,

I have a use case where I know some of my endpoints will never have a cache-control header, then the responses from these endpoints are not supposed to be cached on redis by my RESTDataSource implementation.

I noticed that in line 22 of the HTTPCache module a key is always checked to try hit some cached value.

    const entry = await this.keyValueCache.get(`httpcache:${cacheKey}`);

Is there any intention to have an available option that allows bypassing this behavior on get method of the RESTDataSource? I think this would be a good option for these cases where it is not necessary to check a cache key before every fetch, given that the value will never be found in the cache.

Most helpful comment

This has come up for our team as well.

I'd like to see two of the following changes, and would send a PR if approved:

  1. When !cacheKey, skip caching entirely.
  2. Don't prepend httpcache: if I specify a key. Corporations have key naming requirements we have to follow.

>All comments

This has come up for our team as well.

I'd like to see two of the following changes, and would send a PR if approved:

  1. When !cacheKey, skip caching entirely.
  2. Don't prepend httpcache: if I specify a key. Corporations have key naming requirements we have to follow.
Was this page helpful?
0 / 5 - 0 ratings