DEV Community

Discussion on: Build Url Shortener API In Django - Redis

Collapse
 
itachiuchiha profile image
Itachi Uchiha • Edited

Thanks. It looks very good <3. For improvement;

You can find count for all possibilities to hash length. Because you can check it like that;

if n_possible_count == redis_n_count:
    n_possible_count += 1

So you avoid duplicates. Of course, you should check the hash either exists in the database or not.

Collapse
 
max236 profile image
Mageshwaran

Sure, we can use incremental value. Instead of checking the hash is already exists.
This will improve the performance.