Deleting Records

There are many ways to delete records from the key-value store. The simplest way to delete is to delete a record based on a single key. Programmers can perform a multiDelete where the major key component of a key is provided and all the keys that match the major key component will be deleted. The following code snippet demonstrates both ways of deleting the records. The major key components and the minor key component are initialized for a particular Key.

public class DeleteRec {
public static void main(String[] args) {

final KVStore store;
String storeName = “kvstore”;
String hostName = “localhost”;
String hostPort = “5000”;

KVStoreConfig conf = new KVStoreConfig(storeName, hostName + “:” + hostPort);
store = KVStoreFactory.getStore(conf);

ArrayList<String> majorList = new ArrayList<String>();
ArrayList<String> minorList = new ArrayList<String>();



Key myKey = Key.createKey(majorList, minorList);
Boolean b = store.delete(myKey);
System.out.println(“Single Record is deleted and the boolean value returned is “+b);

The output for above is as :


Leave A Reply

Your email address will not be published. Required fields are marked *