I run flask / memcached and looking for a lean / efficient method to prevent automatic scripts from popping me with requests and / or sending new messages too quickly.
I had to include the "last_action" time in the session cookie and check every request for it, but no matter what time I set, the script could have been set for so long.
I also thought that I need to grab the IP address, and if too many requests from it are made in x amount of time, refuse more for it for so long, but it will require something like redis to work efficiently, which I would like to avoid to pay for.
I prefer a cookie based solution if something like redis can prove it is worth it.
What are “industry standards” to deal with such situations? What methods come with the least cost / performance trade-offs?
source share