I'd like to use Cassandra to store a counter. For example how many times a given page has been viewed. The counter will never decrement. The value of the counter does not need to be exact but it should be accurate over time.
My first thought was to store the value as a column and just read the current count, increment it by one and then put it back in. However if another operation is also trying to increment the counter, I think the final value would just be the one with the latest timestamp.
Another thought would be to store each page load as a new column in a CF. Then I could just run get_count()
on that key and get the number of columns. Reading through the documentation, it appears that it is not a very efficient operation at all.
Am I approaching the problem incorrectly?