use of com.aerospike.client.Key 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.Key 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.Key in project XRTB by benmfaul.
the class RedissonClient method hmset.
/**
* Mimic a REDIS mhset operation.
* @param id String. The key of the map.
* @param m Map. The map to set.
*/
public void hmset(String id, Map m) throws Exception {
if (ae == null) {
cache.put(id, m);
return;
}
Key key = new Key("test", "cache", id);
Bin bin1 = new Bin("value", m);
ae.getClient().put(null, key, bin1);
}
use of com.aerospike.client.Key in project XRTB by benmfaul.
the class RedissonClient method del.
/**
* Delete a bid key from the cache/aerospile.
* @param skey String. The key name.
* @throws Exception on Aerospike/cache errors.
*/
public void del(String skey) {
if (ae == null) {
cache.remove(skey);
return;
}
Key key = new Key("test", "cache", skey);
ae.getClient().delete(null, key);
}
use of com.aerospike.client.Key in project XRTB by benmfaul.
the class RedissonClient method addMap.
/**
* Add a map (a user map) to the the cache or aerorspike.
* @param name String. The name of the map.
* @param map Map. The map of the User object.
* @throws Exception on cache2k/aerospike errors
*/
public void addMap(String name, Map map) throws Exception {
if (ae == null) {
cacheDb.put(name, map);
return;
}
Key key = new Key("test", "database", "rtb4free");
String data = mapper.writer().writeValueAsString(map);
Bin bin1 = new Bin("map", data);
ae.getClient().put(null, key, bin1);
}
Aggregations