Ruby on Rails - generating bit.ly style uuids

后端 未结 4 1845
天涯浪人
天涯浪人 2021-02-10 12:54

I\'m trying to generate UUIDs with the same style as bit.ly urls like:

http://bit.ly/aUekJP

or cloudapp ones:

http://cl.ly/1hVU         


        
4条回答
  •  有刺的猬
    2021-02-10 13:27

    The only way to guarantee uniqueness is to keep a global count and increment it for each use: 0000, 0001, etc.

提交回复
热议问题