Home>

The question is possible stupid, but concerns exactly the right implementation.

There are 3 features that work with the same data. One periods once every 1 minute, two times in 10 minutes. Now it is implemented so that each function makes a new request to the site and the parsing data is re-on.

Tell me, please, how best to implement the following model of work. Automatically, data from the site, and each function when triggered takes the latest data to be taken from the site.

As far as I understand this is a permanent process in the background that replaces the variable, and when you call the functions, this variable is transmitted to them. It is not entirely clear how to run this constant process correctly.

Combine into class and store everything in Self.Variables?

Andy Pavlov2021-07-22 10:07:07

That is, I make an asynchronous feature that performs the parsing every minute and writes everything in an instance of the class, and this instance is updated and use this instance if you can register this class methods?

Sh.Kirill2021-07-22 10:14:39

I would be better in some kind of lightweight database, such data kept so as not to bathe with thread safety. Well, if the data is not very large.

CrazyElf2021-07-22 10:18:28