1

I'm creating a plugin which is dependent on an external API. And i have to make about a 1000 HTTP requests to the API in order to get a lot of data. And there has to be a 1 second delay between the requests. So, getting all of the data would last around 15 minutes or so, and i have to update the data daily.

So, I thought storing the data in a transient and updating it in the background. I found this libraries: WP-TLC-Transients, Async Transients that should help with that. Althought I am not sure if those libraries affect the max_execution_time of the php, since 15 minutes is a lot and above most user values for max_execution_time.

Anyway, if i make that work, the main issue is how do i store some default data from that API, which was previously somehow collected (don't know how exactly) when the user activates the plugin. As far as i understand it, when a user activates the plugin he will have to wait that first time for 15 minutes until the inital (a new) data is generated and I'm trying to resolve that so that the user could have the data right away.

Another thing that crossed my mind is if i do manage to get that previously collected data to the user on the activation, how do i make it so that data isn't that old as well. If i redistribute it with the plugin, someone might use it a year later and then have an year old data on the activation.

I might be going at this the wrong way, so, any help is appreciated, since i'm rather unexperienced with transients.

Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.