I've got a map,
with hundreds of action listener (one for each position of the map), when the user click on one cell/tile of the map he gets more information about this cell (information are displayed in the same page).
I want to store in a MySQL database the number of times that a cell has been clicked.
The problem is that I want to let a user to click and gain information quickly (-->the user will click often), and doing a query every time he clicks slows down performances. Moreover having a huge number of user doing a query for every click, and a significant number of click for every user, will fill my database bandwidth.
So I want to have a "buffer" on client that stores the clicks, and update/insert them into my database Asynchronously (for example doing the query when the user leave page, after a number of clicks, after tot seconds, ... ). I know I can do it with JS but it seems ugly to me, isn't it? How would you do it? (code is appreciated but not mandatory)
Summary: I want to avoid doing a query on click, I want to do a query after a set of clicks (reducing the number of query) and without losing clicks.