Atom 是由 ukey 改名,此版本主要修复了一些 bug,增加了 atom_explain() 函数,此函数可以将 ID 转换成一个包括“timestamp”,“datacenter”和“worker”的数组。
此版本可以使用在生产环境。
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