zreptil / nightscout-reporter

a web app to create PDF documents from nightscout data
https://nightscout-reporter.zreptil.de/
BSD 3-Clause "New" or "Revised" License
59 stars 47 forks source link

Caching duration of the Nightscout querys #29

Closed nshtg closed 4 years ago

nshtg commented 4 years ago

I noticed NR caches the querys for a certain duration. Is there a way to manually clear the cache as a user?

Background: I sometimes manually delete really noisy timeframes from my nightscout db (e.g. normal bg but dexcom shows me at 39 mg/dl for 1hr, screws all the stats that are important).

nshtg commented 4 years ago

Seems to be localStorage so clearing browser cache does the trick.

zreptil commented 4 years ago

NR doesn't cache data or queries between sessions. During a session NR keeps the data after creating the first report so that the user can create multiple pdfs without having to fetch the data from the server again. If something in the query changes (e.g. the start- or enddate) the data is thrown away and the query is executed again.

But if you do F5 in the browser all data is cleared and the next query will go to the server. Clearing localStorage clears the settings and when you enter the page again it will be as if you enter it for the first time. All the data, that NR needs to work (the url, the name and so on) is saved to localStorage. So clearing it will give you a fresh start of NR in this browser.

For Nightscout itself i cannot say, when the data is updated. I also noticed that sometimes there is a delay of several minutes between changing something in the data and seeing this change in NR. Maybe the Nightscout Instance has caching mechanisms.

For NR i can say: if you press F5 every query data will be thrown away. There is no caching of queries.