question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RESTDataSource has double caching

See original GitHub issue

It stores all caches in cache implementation InMemory, Redis, Memcache and also in Map object. Second time if you send same request it will return the cache value from the Map. This will override ttl config. Not sure also how this is safe, in terms of memory, how big the map object will be if it stores all responses.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
martijnwalravencommented, Aug 13, 2018

@uarsovic Yeah, that’s not how data sources are meant to be used. You should export the class from your other module and instantiate it in the dataSources function.

Sharing a data source between requests will be guaranteed to lead to trouble, because it means you don’t have access to the current request’s context through this.context for example. And we plan on extending data sources with more features that require them to be bound to a request, like tracing of backend calls.

0reactions
roman-16commented, Jul 23, 2019

I think this should be somehow documented, I had the same problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Odyssey Part 2 - Caching of RESTDataSource does not ...
I have the same issue, because the /tracks endpoint is cached, but /author/{id} isn't, the data source doesn't speed up the request that...
Read more >
How Apollo REST Data Source Deduplicates and Caches ...
Today I learned that RESTDataSource comes with two awesome performance optimizations out of the box: Request Deduplication and Resource Caching.
Read more >
Apollo - Server(GraphQL): Using Batching together with ...
I mean, here we have 2 caching layers. The DataLoader which batches requests and memorizes - with an per-request cache - which objects...
Read more >
Apollo Rest DataSource - YouTube
When working with a GraphQL server many times you want to get data from an external api. Apollo can cache these requests using...
Read more >
Manage data freshness - Looker Studio Help
Fetching cached data can be much faster than fetching. ... Every component in a Looker Studio report has its own individual cache. That...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found