"" + 237498237498273908472390847239084710298374901823749081237409273492374098273904872398471298374
> '2.3749823749827392e+92'
我以一种美丽而神秘的方式计算 ID:
time = new Date().getTime()
pid = process.pid
host = 0; (host +=s.charCodeAt(0) for s in os.hostname())
counter = MIPS.unique_id()
"#{host}#{pid}#{time}#{counter}"
不幸的是,在 ID 的某个地方(例如11207648813339434616800
)。不幸的是,这意味着他们有时会求助于1.1207648813339434e+22
.
更新:
这似乎是redis的“错误/功能”。万万没想到。
# Bug with Big Numbers on zadd
redis = require 'redis'
r = redis.createClient()
r.zadd 'zset', '342490809809999998098', 'key', ->
r.zscore 'zset', 'key', (_, results) ->
console.log typeof results # string
console.log results # 3.4249080981000002e+20