create column family PwdUrl with
default_validation_class=UTF8Type and key_validation_class=UTF8Type and
comparator =UTF8Type and
column_metadata = [ {
column_name:createdAt,
validation_class:UTF8Type,
index_type: KEYS
},{
column_name:expireAt,
validation_class:UTF8Type,
index_type: KEYS}
]
这是我需要设置的架构。是否可以使用phpcassa执行此操作?如果没有,还有其他选择吗?
答案 0 :(得分:4)
是的,你可以用phpcassa做到这一点。您将使用SystemManager课程。这是一个例子:
<?php
require_once('phpcassa/sysmanager.php');
$sys = SystemManager("localhost:9160");
$my_keyspace = "Keyspace1";
$cfattrs = array("column_type" => "Standard",
"comparator_type" => "UTF8Type",
"default_validation_class" => "UTF8Type",
"key_validation_class" => "UTF8Type");
$sys->create_column_family($my_keyspace, "PwdUrl", $cfattrs);
$sys->create_index($my_keyspace, "PwdUrl", "createdAt", "UTF8Type");
$sys->create_index($my_keyspace, "PwdUrl", "expireAt", "UTF8Type");
$sys->close();
?>