What does a URL shortener do, and what are its two main operations?
Sketch your own answer first, then compare it with the one below.
A strong answer
It maps a short code to a long address. The two operations are create, which takes a long address and returns a code, and redirect, which takes a code and sends the user to the long address.
The store behind it is a key-value table keyed by code. Reads far outnumber writes, so a good answer says so early and plans a cache.
Sources
- Roy Fielding, Mark Nottingham, Julian Reschke (2022). RFC 9110: HTTP Semantics.