Im developing an application based on Spring and JSF 2.0. You must remember how many times a client from a specific ip address tried to send a form in the last 3 minutes. If more than 3 sending attempts were recorded within 3 minutes, then captcha is displayed.
I am thinking of using ConcurrentMap<String, ConcurrentLinkedQueue<Long>> to store the ip address ( String ) and send the time (milis) to the queue ( ConcurrentLinkedQueue<Long> ). The queue will be cleared with quartz at 3-minute intervals (milis older than 3 minutes will be deleted). To check if the conversion will be displayed, I will check if the queue size is> 3.
Is this the right approach? Do you have any ideas?
source share