I want to store the variable on the disk store and only call it when Node-RED is restarted. At that point I want to use the default store for processing the data. I only want to update the disk store every 5 minutes.
I am not sure which store to be writing to or calling.
What is the proper way to implement disk store? I am not sure how flushInterval will automatically write the default store to disk store.
Where I am confused if I write to 'disk' will the flushInterval only update the actual store based on the setting (i.e = 30 seconds). If i have to create a flow to push the default store to disk then how does flushInterval fit into this?
I believe 30 is default.
This will not copy default store to disk store. They are separate stores. To copy default to disk every 5 mins set up a flow to do this.
If you write it to the store called disk then that is where you must read it from. It will only read the disk once as it keeps a cached copy for you to use. It only writes to disk at the interval that you specify and only then if the value has been written to since the last flush.
Don't think of it as a store on disk, think of it as a store in memory that is backed up on disk when required and restored on startup.
Further to my last post, use the default (memory) store for data that does not need to be restored on startup, and use the disk backed store for data that does need to be restored.
However, it is good practice to minimise the use of context. Wherever possible send data using messages and only store in context when there is a real advantage to doing that.