Design a URL Shortener: Encoding, Caching, and the Redirect Path