计数器的batch_mutate
是否可以在 php 中使用batch_mutate作为计数器? 从我所看到的来看,一般来说应该可以增加计数器,但我似乎找不到任何语言的任何工作示例。
谢谢
Is it possible to use batch_mutate for counters in php?
From what I've seen, it should be possible to increment counters in general, but I can't seem to find any working examples in any language.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
提供给batch_mutate的Mutation对象包含一个ColumnOrSuperColumn (CoSC)对象。 CoSC,尽管有它的名字,也可以是 CounterColumn 或 SuperCounterColumn 以及 Column 和 SuperColumn。
不太确定 PHP 实现是如何工作的,但尝试构建 ColumnOrSUperCOlumn 作为 CounterColumn ,这应该可以满足您的要求。
FWIW,这是一个 Java 示例:
https://github.com/rantav/hector/blob/master/core/src/test/java/me/prettyprint/cassandra/service/BatchMutationTest.java#L135-151
The Mutation objects supplied to batch_mutate contain a ColumnOrSuperColumn (CoSC) object. CoSC, despite it's name, can also be a CounterColumn or SuperCounterColumn as well as Column and SuperColumn.
Not quite sure how the PHP implementation works, but try constructing a ColumnOrSUperCOlumn as a CounterColumn and that should do what you want.
FWIW, here is an example in Java:
https://github.com/rantav/hector/blob/master/core/src/test/java/me/prettyprint/cassandra/service/BatchMutationTest.java#L135-151