The primary operations used in Cassandra are get and insert operations. In many applications, data can become stale and is no longer needed. In these type of application, a process can be used to iterate all the data on the node using range scans. This recipe shows how to use range scans to iterate all the data in a cluster and remove data older than a user-supplied number of seconds.
Create a file
<hpcbuild>/src/hpcas/c03/Ranger.java
.package hpcas.c03; import hpcas.c03.FramedConnWrapper; import hpcas.c03.Util; import java.math.BigInteger; import java.util.*; import org.apache.cassandra.thrift.*; import org.apache.cassandra.utils.FBUtilities; public class Ranger { int size = 0; Cassandra.Client client = null; FramedConnWrapper fcw = null; /*The maximum token in a Cassandra is 2^127. Range scans should not go past this number.*/ java.math.BigInteger max = new java.math.BigInteger("2").pow(127); java.math.BigInteger...