Reputation: 695
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
Upvotes: 2
Views: 204
Reputation: 1908
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
Upvotes: 2