A 301 would save your short links traffic. Pick 302 anyway.
transcript
Your short links could take less traffic. One status code. Pick it, and you lose control of every link.
The interviewer asks: why 302? A 301 can be cached by browsers. So repeat clicks skip your server. Less load. Sounds great. But you stop seeing those clicks. And a deleted link keeps redirecting. A 302 brings every click back to you. Counts stay right. Deletes work at once.
Picture it. Someone clicks your link. Their browser can keep the 301. Now you delete the link. Your server knows it's gone. Their browser doesn't ask you. It keeps redirecting, from a cache you don't control.
The cost of 302? More traffic. So make each redirect cheap. Hot codes sit in Redis. Most redirects never touch the database. Unknown codes get a cached 404. Scanners stop hammering the store. One link goes viral? A short cache at the CDN edge absorbs the burst.
Analytics and deletes were requirements. So 302. Pick the code that keeps you in control. Then make it cheap.
Full breakdown in the lecture.