mercredi 24 novembre 2021

Working with snowflake IDs, how to generate them?

I'm trying to create a highly secure login & registration system in PHP and I want to add snowflake IDs, but I don't know how to generate them correctly.

Let's say, that I have an $epoch = 1637768288;, $currentTimestamp = new DateTime()->getTimestamp();, $workerID, $processID, and finally $sequence. (Followed by explanation in this video)

And here is the part of code, when I'm not sure what to do. How can I actually take all of these data and create a "snowflake id" from it? And how can I generate the sequence number, worker and process id, as the video explains?

Thanks,
Adalbert




Aucun commentaire:

Enregistrer un commentaire