I need to persist certain values to disk across restarts and deploys. I found node-red-contrib-persist but it appears to have been abandoned and throws some warnings about deprecated calls on startup. Is there a more up-to-date best practice for this?
Welcome to the forum!
Have a look at this introduction to context :
https://nodered.org/docs/user-guide/context
This is awesome, thank you. When are the persisted values loaded and available to functions? I tried tracing out a value in a function.onStart and it was undefined.
Show us
- what you entered in the function node
- How you setup the context in settings.js
- What you see in the context viewer
This was my error, all is working as expected.
One additional question - I see that I can set the "flushInterval" in settings.js, but is there a way to manually call a flush from a node? I'll only be updating values very intermittently and would prefer to manually force a save if possible.
Afaik it only flushes if something has changed so generally it just works.