I have a Column family in Cassandra in which I am going to store something like this-
BundleName | Version
----------------------------
FrameworkBundle 1.0.0
BundleA 1.0.0
BundleB 1.0.0
BundleC 1.0.0
BundleD 1.0.0
I am using Astyanax client to retrieve the data from Cassandra database. I am going to have some method which will retrieve the data from Cassandra-
public Map<String, String> getFromDatabase() {
// 1) For the first time, return me everything in the map
// 2) Second time, it should return me only the the change if there is any bundle version change
}
Now this method should return me everything as the Map, something like this-
Key as FrameworkBundle and Value as 1.0.0
Key as BundleA and Value as 1.0.0
Key as BundleB and Value as 1.0.0
....
And for other Bundles like above
Now what I need is-
- For the first time when I am running my application, it should return me everything in the map just like above.
- And I have a background thread that will check the Cassandra database every 15 minutes to see if there are new versions of the bundles or not. And if there are any new version of any bundle then just return me that Bundle Name and its new version and if there are no changes in any of the version, then don't return me anything second time. And this same process will happen every 15 minutes then.
Meaning only the first time, I want to return everything otherwise, I don't want to return anything unless there is any change in the bundle version.
I am not sure whether Cassandra can provide directly the information on this without writing some sort of logic to get the information I need.
What's the best and efficient way to do this thing out in the Cassandra? I dont want to retrieve all the data from Cassandra database every 15 minutes and then do some sort of logic to find out which bundle version got changed..