educative.io

Clarity on requirements

  1. is it a requirement for longurl to get same mapping each time user asks to map or we can return a new short url each time?
    If not, how does the proposed design handles this case?

Hi @Satish_Pudi,

Every time User asks, the system will generate a new unique short URL, this is what is required from the system.

If we want to get the same short URL for the long URL every time, it will be per user, right? Because we don’t want every user of the system to have the same short URL as users have different tracking requirements for their shortened URLs. And if we want to return the same short URL for a long URL for a User, why would the user want to do that again and again? Anyway to meet this requirement , we need to check the DB to see if that User has already shortend that URL before, if so, simple return its short URL.

Hope this answered your question