Hi,
Help with creating a control record as a program variable.
I am writing a script to call ~10 APIs and analyse the data on frequent basis (>10 & < 60+ times an hour). The APIs can take 0.5 to 3 seconds each. Each API represents a different timeframe from a Month down to a Minute, so if the timeframe is still current and therefore the data has not changed since the last update (most likely Monthly, Weekly and Daily) then I want to avoid calling the API as well as analysing the data, by using the existing data that was previously extracted and analysed (This will be in memory as the program will still be active).
I planned to do this by keeping a control record with a 'timestamp' for each API. Element 1 being the Month timeframe and the last element being the one minute timeframe. The record being updated by a new timestamp in the corresponding element when an update has occured.
My limited "understanding" of lists, is that inserting a an element into a specific position with cause the new element to force some elements further down the list, thus changing their position.
So the array would look like this:
api_control [ timestamp, timestamp, timestamp etc.]
Where the first timestamp would refer to Months, the second to weeks, then days, 12 hours, 8 hours.... 5 minutes.
Ditto "understanding" - Tuples on the surface, may not be best suited, but see caveat!
Obviously I could keep a number of variables, one for each timeframe, but this looks like it is unnecessarily messy etc. etc.
I would be grateful for thoughts / a pointer to a "workable solution"
Thanks
Bass
Help with creating a control record as a program variable.
I am writing a script to call ~10 APIs and analyse the data on frequent basis (>10 & < 60+ times an hour). The APIs can take 0.5 to 3 seconds each. Each API represents a different timeframe from a Month down to a Minute, so if the timeframe is still current and therefore the data has not changed since the last update (most likely Monthly, Weekly and Daily) then I want to avoid calling the API as well as analysing the data, by using the existing data that was previously extracted and analysed (This will be in memory as the program will still be active).
I planned to do this by keeping a control record with a 'timestamp' for each API. Element 1 being the Month timeframe and the last element being the one minute timeframe. The record being updated by a new timestamp in the corresponding element when an update has occured.
My limited "understanding" of lists, is that inserting a an element into a specific position with cause the new element to force some elements further down the list, thus changing their position.
So the array would look like this:
api_control [ timestamp, timestamp, timestamp etc.]
Where the first timestamp would refer to Months, the second to weeks, then days, 12 hours, 8 hours.... 5 minutes.
Ditto "understanding" - Tuples on the surface, may not be best suited, but see caveat!
Obviously I could keep a number of variables, one for each timeframe, but this looks like it is unnecessarily messy etc. etc.
I would be grateful for thoughts / a pointer to a "workable solution"
Thanks
Bass
"The good thing about standards is that you have so many to choose from" Andy S. Tanenbaum