Pergunta de entrevista da empresa Intuit

How can you implement a rate limiter in Java? Need to call a rateLimiter function that return true if you can perform a request and false if you cannot. The rate limiter is limited by number of calls during X seconds, each caller has a unique id.

Resposta da entrevista

Sigiloso

26 de out. de 2024

A map with key = unique Id, value = counter of calls and a thread running in the background that cleans the map each X seconds.