Feature #4: Request Limiter
Understand how to build a request limiter system that controls API request frequency based on status ID and timestamps. This lesson teaches you to use a hashtable for efficient storage and quick validation of duplicate requests within a time interval, helping you master request throttling techniques relevant to real-world coding interviews.
We'll cover the following...
Description
The Facebook Status API queues requests using the requested Status ID and a timestamp. We want to implement a throttling mechanism on the requests that limits one request for a particular Status ID at a pre-configured time interval. Any additional requests for the same Status ID in this interval will be dropped. Multiple requests for different Status IDs can occur at the same time.
We’ll be provided with the name of the request and the time it arrived. Our system will have to decide whether to accept the request or reject it based on its arrival time. In this scenario, we’ll use a time limit of five days before a similar request can be sent from the same or different platform.
Solution
The hashtable data structure will be used to implement this feature. This data structure can ...