设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 软件追踪 查看内容

Atom 0.5发布,PHP的ID生成扩展

2016-12-27 21:53| 发布者: joejoe0332| 查看: 340| 评论: 0|原作者: oschina|来自: oschina

摘要: Atom 是由 ukey 改名,此版本主要修复了一些 bug,增加了 atom_explain() 函数,此函数可以将 ID 转换成一个包括“timestamp”,“datacenter”和“worker”的数组。此版本可以使用在生产环境。PHP unique ID genera ...

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

酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部