Atom 介绍
使用Twitter的 SNowflake算法,有兴趣可以了解一下这个算法: https://github.com/twitter/snowflake
PHP.ini的配置项:
[ukey] ukey.datacenter = integer ukey.worker = integer ukey.twepoch = uint64
Atom
Based on the Twitter SNowflake algorithm
PHP unique ID generator
functions list:
1) string atom_next_id (void);
Get the next unique ID.2) array atom_explain (string ID);
Change unique ID to array includes: timestamp, datacenter id and worker id.
example:
<?PHP $id = atom_next_id(); echo $id; $info = atom_explain($id); echo date('Y-m-d H:i:s', $info['timestamp']); ?>
install:
$ cd ./atom $ PHPize $ ./configure $ make $ sudo make install
PHP.ini configure entries:
[atom] atom.datacenter = integer atom.worker = intger atom.twepoch = uint64