4 ms·
This has always been my favorite way to generate IDs, though I typically do it with a 64bit integer and a custom epoch. Being able to store keys as 64bit integ
by SeoxyS 12y ago
This has always been my favorite way to generate IDs, though I typically do it with a 64bit integer and a custom epoch.
Being able to store keys as 64bit integers is much easier to work with, and also much more efficient than b64 encoding. In the odd case you're working with a language that can't handle numbers (ahem… javascript), you can always encode it as a string.
Here's a library that implements this method: https://github.com/Fubelly/rubyflake https://github.com/Fubelly/rubyflake
- jimktrains2 12y agoI love snowflakes:) I wrote a little rust implementation[1] also [1] https://github.com/jimktrains/rustflake https://github.com/jimktrains/rustflake
- deleted 12y ago[deleted]