12 Star 24 Fork 18

zhouyuan24 / snowflake PHP

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

#snowflake PHP

/**

  • ID 生成策略
  • 毫秒级时间41位+机器ID 10位+毫秒内序列12位。
  • 0 41 51 64 +-----------+------+------+ |time |pc |inc | +-----------+------+------+
  • 前41bits是以微秒为单位的timestamp。
  • 接着10bits是事先配置好的机器ID。
  • 最后12bits是累加计数器。
  • macheine id(10bits)标明最多只能有1024台机器同时产生ID,sequence number(12bits)也标明1台机器1ms中最多产生4096个ID,
  • auth: zhouyuan */ 注意点,因为使用到位移运算,所以需要64位操作系统,不然生成的ID会有可能不正确

Comments ( 4 )

Sign in for post a comment

About

分布式自增ID生成 twitter/snowflake PHP实现 spread retract
Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
PHP
1
https://gitee.com/zhouyuan24/snowflake-PHP.git
git@gitee.com:zhouyuan24/snowflake-PHP.git
zhouyuan24
snowflake-PHP
snowflake PHP
master

Search