I have a plugin in Craft 2 that will make an API call to an external API to gather and display data on a template; however, I would like to limit the number of calls to a certain number per second (or to sleep for a set number of milliseconds).

I have found some examples of PHP code that do this; however, they usually require a database table or flat file to reference the count. I was wondering if there is anything Craft-centric that might exist which would assist in this, or if this would be more a case of using pure PHP code in the plugin to connect to the db and to query the db in assistance to setting the limit? Thanks for any leads


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.