cult-of-coders / grapher

Grapher: Meteor Collection Joins + Reactive GraphQL like queries
https://atmospherejs.com/cultofcoders/grapher
MIT License
275 stars 53 forks source link

How to test Grapher Cache #443

Closed LordA98 closed 3 years ago

LordA98 commented 3 years ago

Hi,

I've implemented caching on a couple of queries. I do not get any errors but I'm struggling to test it / check that it is in fact doing something.

How can I do this? I tried to ask on the Meteor forums but got no response.

Thanks, Alex

theodorDiaconu commented 3 years ago

You can follow the example to create your own and just do a unit test.

LordA98 commented 3 years ago

Sorry, I don't mean automated testing. I mean how can I visually see that content is being stored in the cache?

With regards to your comment - what would the unit test be testing / checking against?

theodorDiaconu commented 3 years ago

Well it's easy to test right? Put a cache of 10 minutes. Get the data. Modify the data in db. Get the data again, and see if it works?

LordA98 commented 3 years ago

Okay. I've tested it and it appears to be working.

I think the reason I was struggling before was because I was trying to test it using a reactive pub/sub query.

This might be a stupid question, but for clarity, does it only work for Methods? Not Pub/Sub?

theodorDiaconu commented 3 years ago

Pubsub is live data, can’t be cached if its live.

Sent from my iPhone

On 7 Feb 2021, at 19:59, Alex Lord notifications@github.com wrote:

 Okay. I've tested it and it appears to be working.

I think the reason I was struggling before was because I was trying to test it using a reactive pub/sub query.

This might be a stupid question, but for clarity, does it only work for Methods? Not Pub/Sub?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

LordA98 commented 3 years ago

Cool, thanks for the clarity.