Intermediate · 30 min · 4 steps
Stopping a toll from being charged twice
Deepa Krishnan, Toll Infrastructure Engineer at PulsePay
Deepa Krishnan is an engineer at PulsePay, a company that runs the payment side of FASTag, the electronic toll system on Indian highways. A FASTag is a small sticker on a car's windscreen. An antenna at the toll gate reads it and takes the toll money from the driver's wallet.
The question
How do we build a small in-memory cache in Python that stops the same FASTag toll from being charged twice when the same scan arrives again within a second?
- Idempotency keys
- Sliding window caches
- Time-To-Live (TTL)
- Atomic key expiration
The rest of this case study is locked
The data, every step with its code and result, and the final answer open with a pass. A few case studies stay free so you can see how they work.