use of com.aerospike.client.Bin in project apex-malhar by apache.
the class AbstractAerospikeTransactionalPutOperator method processBatch.
@Override
public void processBatch(Collection<T> tuples) {
Key key;
Bin[] binsArray;
try {
for (T tuple : tuples) {
key = getUpdatedBins(tuple, bins);
binsArray = new Bin[bins.size()];
binsArray = bins.toArray(binsArray);
store.getClient().put(null, key, binsArray);
bins.clear();
}
} catch (AerospikeException e) {
throw new RuntimeException(e);
}
}
use of com.aerospike.client.Bin in project apex-malhar by apache.
the class AerospikeTransactionalStore method storeCommittedWindowId.
@Override
public void storeCommittedWindowId(String appId, int operatorId, long windowId) {
try {
String keyString = appId + String.valueOf(operatorId);
Key key = new Key(namespace, metaSet, keyString.hashCode());
Bin bin1 = new Bin(metaTableAppIdColumn, appId);
Bin bin2 = new Bin(metaTableOperatorIdColumn, operatorId);
Bin bin3 = new Bin(metaTableWindowColumn, windowId);
client.put(null, key, bin1, bin2, bin3);
} catch (AerospikeException e) {
throw new RuntimeException(e);
}
}
use of com.aerospike.client.Bin in project apex-malhar by apache.
the class AbstractAerospikeNonTransactionalPutOperator method processTuple.
@Override
public void processTuple(T tuple) {
Key key;
Bin[] binsArray;
try {
key = getUpdatedBins(tuple, bins);
binsArray = new Bin[bins.size()];
binsArray = bins.toArray(binsArray);
store.getClient().put(null, key, binsArray);
bins.clear();
} catch (AerospikeException e) {
throw new RuntimeException(e);
}
}
use of com.aerospike.client.Bin in project XRTB by benmfaul.
the class RedissonClient method hmset.
/**
* Do a mhset with expire (No op on cache2k, expiry already set globally
* @param id String. The key name.
* @param m Map. The value to set.
* @param expire int. The number of seconds before expiry.
* @throws Exception on Cache2k or aerospike errors.
*/
public void hmset(String id, Map m, int expire) throws Exception {
if (ae == null) {
cache.put(id, m);
return;
}
WritePolicy policy = new WritePolicy();
policy.expiration = expire;
Key key = new Key("test", "cache", id);
Bin bin1 = new Bin("value", m);
ae.getClient().put(policy, key, bin1);
}
use of com.aerospike.client.Bin in project XRTB by benmfaul.
the class RedissonClient method expire.
/**
* Expire a key (no op on Cache2k, expirt is set globally for it).
* @param id String. The key to expire.
* @param expire int. The number of seconds before expiration.
* @throws Exception on cache2k or Aerorpike errors.
*/
public void expire(String id, int expire) throws Exception {
if (cache != null) {
return;
}
Key key = new Key("test", "cache", id);
Record record = null;
record = ae.getClient().get(null, key);
if (record == null) {
return;
}
Bin bin = new Bin("value", record.bins.get("value"));
WritePolicy policy = new WritePolicy();
policy.expiration = expire;
ae.getClient().put(policy, key, bin);
}
Aggregations