use of com.aerospike.client.Record in project XRTB by benmfaul.
the class AeroRange method main.
public static void main(String[] args) throws Exception {
AerospikeClient client = new AerospikeClient(args[0], 3000);
String skey = "accountingsystem";
Key key = new Key("test", "cache", skey);
while (true) {
Record record = null;
record = client.get(null, key);
String value = (String) record.bins.get("value");
System.out.println(value);
Thread.sleep(1000);
}
}
use of com.aerospike.client.Record in project XRTB by benmfaul.
the class CookieList method main.
public static void main(String[] args) throws Exception {
int i = 0;
String aero = "localhost:3000";
String setName = null;
String mapName = null;
String op = null;
String name = null;
String file = null;
boolean range = false;
AerospikeClient client = new AerospikeClient("localhost", 3000);
Key key = new Key("test", "database", "rtb4free");
ArrayList<String> list = new ArrayList<String>();
TreeSet set = new TreeSet();
for (i = 0; i < 100000; i++) {
list.add(Integer.toString(i));
set.add(Integer.toString(i));
}
Bin bin1 = new Bin("c1x-cookies", set);
client.put(null, key, bin1);
System.out.println("Done!");
Record record = client.get(null, key);
long time = System.currentTimeMillis();
Set<String> receivedList = (Set<String>) record.getValue("c1x-cookies");
receivedList.contains("99999");
System.out.println(System.currentTimeMillis() - time);
System.out.println("Received List = " + receivedList.size());
}
use of com.aerospike.client.Record in project gora by apache.
the class AerospikeStore method get.
/**
* {@inheritDoc}
*
* @param key the key of the object
* @param fields the fields required in the object. Pass null, to retrieve all fields
* @return the Object corresponding to the key or null if it cannot be found
*/
@Override
public T get(K key, String[] fields) throws GoraException {
try {
Key recordKey = getAerospikeKey(key);
fields = getFieldsToQuery(fields);
Record record = aerospikeClient.get(aerospikeParameters.getAerospikeMapping().getReadPolicy(), recordKey, fields);
if (record == null) {
return null;
}
return createPersistentInstance(record, fields);
} catch (GoraException e) {
throw e;
} catch (Exception e) {
throw new GoraException(e);
}
}
use of com.aerospike.client.Record in project aerospike-client-java by aerospike.
the class ScanPartitionCommand method parseRow.
@Override
protected void parseRow(Key key) {
if ((info3 & Command.INFO3_PARTITION_DONE) != 0) {
// specified partition will need to be requested on the scan retry.
if (resultCode == 0) {
tracker.partitionDone(nodePartitions, generation);
}
return;
}
if (resultCode != 0) {
throw new AerospikeException(resultCode);
}
Record record = parseRecord();
if (!valid) {
throw new AerospikeException.ScanTerminated();
}
callback.scanCallback(key, record);
tracker.setDigest(nodePartitions, key);
}
use of com.aerospike.client.Record in project aerospike-client-java by aerospike.
the class RWTaskSync method get.
@Override
protected void get(Key key) {
Record record;
if (counters.read.latency != null) {
long begin = System.nanoTime();
record = client.get(args.readPolicy, key);
long elapsed = System.nanoTime() - begin;
counters.read.latency.add(elapsed);
} else {
record = client.get(args.readPolicy, key);
}
processRead(key, record);
}
Aggregations