Persistent variables?

Hi,

I am using 15 global variables in my flows, to take care of several status events. If/when I restart node-red or reboot the server, I am losing those variables. Is there any way to make then persistent through restart?

maybe this will help: A guide to understanding 'Persistent Context'

1 Like

Your guide is GREAT!
Thanks a lot.

@zenofmud Paul, is it allowed to have 2 different localfilesystem modules, like this:

contextStorage: {
                myFile1: { module: "localfilesystem"},
    	        myFile2: { module: "localfilesystem" }
    },

and then address them this way:

global.set("foo", 123, "myFile1");  
global.set("bar", 234, "myFIle2");

??

Does it not work?

Didn’t try...

If you had then you would know the answer by now.

1 Like

Thank you. If you answered just YES or NO, you would have saved a lot of characters.

Maybe Colin didn't know or didn't have time to test it for you or was perhaps encouraging you to try it out as a voyage of discovery and self learning?

The thing about this forum is - it is literally the most active and supportive forum I have ever frequented - EVER - there are soo many helpful members who go to great lengths to help out folk but when a person doesn't try anything for themselves, we feel somewhat less motivated - I am sure you can appreciate that?

For the benefit of future readers of this thread - what were your findings? is it possible to have 2 different localfilesystem modules?

I was in a train when I wrote my messages. Now I have just reached home and I will have to test, but I was trying to save some time if someone already knew the answer. Do not assume that everyone is cheating. I do appreciate this forum, indeed. But I wasn't at my desk when I have answered the question.

I will be more careful in the future.

1 Like

I confirm: yes. It works.

1 Like

Excellent, thanks. I had looked at your syntax and it looked ok, but I couldn't test it at that time. Now I know the answer should I need to do this.

Out of interest what use case do you have that needs this?

Nothing special, but I have many variables to make persistent and I am dividing them into 2 groups just to make order in my mind. In addition, in this way I can recall all the variables in a group without mixing with the other.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.