【问题标题】:Snowflake key algorithm in PHP using PHPCassa [duplicate]PHP中使用PHPCassa的雪花密钥算法[重复]
【发布时间】:2012-05-07 15:52:05
【问题描述】:

可能重复:
how to have 64 bit integer on PHP?

是否可以在 Cassandra 中使用 PHPCassa 使用 64 位长整数作为键?

例如,

$pool = new ConnectionPool('main', array("127.0.0.1")); 
$table = new ColumnFamily($pool, 'messages'); // ColumnFamily 
$table->insert("5601379860409749867", array("sampleKey" => "sampleValue)); 

每次插入时,我都会得到 0 作为密钥。在这个表中,key_validation_class 是 LongType。

【问题讨论】:

标签: php cassandra phpcassa


【解决方案1】:

这完全取决于您服务器的操作系统能力,而不是 PHPCassa 的限制。

本机 64 位整数需要 64 位硬件和 64 位版本的 PHP。

在 32 位硬件上:

$ php -r 'echo PHP_INT_MAX;'
2147483647

在 64 位硬件上:

$ php -r 'echo PHP_INT_MAX;'
9223372036854775807

【讨论】:

    猜你喜欢
    • 2012-02-18
    • 2022-01-14
    • 2023-03-26
    • 2020-08-28
    • 2018-03-01
    • 2021-09-16
    • 1970-01-01
    • 1970-01-01
    • 2021-10-16
    相关资源
    最近更新 更多