"" + 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