OfferUp Interview Question

How would you implement rate-limiting in code?