本文整理汇总了Java中com.aerospike.client.AerospikeClient.put方法的典型用法代码示例。如果您正苦于以下问题:Java AerospikeClient.put方法的具体用法?Java AerospikeClient.put怎么用?Java AerospikeClient.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.aerospike.client.AerospikeClient
的用法示例。
在下文中一共展示了AerospikeClient.put方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeAerospike
import com.aerospike.client.AerospikeClient; //导入方法依赖的package包/类
@Override
public void writeAerospike(Text sessid,
Session session,
AerospikeClient client,
WritePolicy writePolicy,
String namespace,
String setName) throws IOException {
writePolicy.timeout = 10000;
Key kk = new Key(namespace, setName, sessid.toString());
Bin bin0 = new Bin("userid", session.userid);
Bin bin1 = new Bin("start", session.start);
Bin bin2 = new Bin("end", session.end);
Bin bin3 = new Bin("nhits", session.nhits);
Bin bin4 = new Bin("age", session.age);
Bin bin5 = new Bin("isMale", session.isMale);
client.put(writePolicy, kk, bin0, bin1, bin2, bin3, bin4, bin5);
}
示例2: writeAerospike
import com.aerospike.client.AerospikeClient; //导入方法依赖的package包/类
@Override
public void writeAerospike(Object key,
AerospikeRecord record,
AerospikeClient client,
WritePolicy writePolicy,
String namespace,
String setName) throws IOException {
Key k = new Key(namespace, setName, key.toString());
List<Bin> bins = new ArrayList<>();
for (Map.Entry<String, Object> bin : record.bins.entrySet()) {
Bin aerospikeBin = new Bin(bin.getKey(), bin.getValue());
bins.add(aerospikeBin);
}
client.put(writePolicy, k, bins.toArray(new Bin[bins.size()]));
}
示例3: writeAerospike
import com.aerospike.client.AerospikeClient; //导入方法依赖的package包/类
@Override
public void writeAerospike(Text sessid,
Session session,
AerospikeClient client,
WritePolicy writePolicy,
String namespace,
String setName) throws IOException {
Key kk = new Key(namespace, setName, sessid.toString());
Bin bin0 = new Bin("userid", session.userid);
Bin bin1 = new Bin("start", session.start);
Bin bin2 = new Bin("end", session.end);
Bin bin3 = new Bin("nhits", session.nhits);
client.put(writePolicy, kk, bin0, bin1, bin2, bin3);
}
示例4: writeAerospike
import com.aerospike.client.AerospikeClient; //导入方法依赖的package包/类
@Override
public void writeAerospike(Text key,
IntWritable value,
AerospikeClient client,
WritePolicy writePolicy,
String namespace,
String setName) throws IOException {
Key kk = new Key(namespace, setName, key.toString());
Bin bin1 = new Bin("word", key.toString());
Bin bin2 = new Bin("count", value.get());
client.put(writePolicy, kk, bin1, bin2);
}
示例5: writeAerospike
import com.aerospike.client.AerospikeClient; //导入方法依赖的package包/类
@Override
public void writeAerospike(LongWritable userid,
Profile profile,
AerospikeClient client,
WritePolicy writePolicy,
String namespace,
String setName) throws IOException {
writePolicy.timeout = 10000;
Key kk = new Key(namespace, setName, userid.get());
Bin bin0 = new Bin("userid", profile.userid);
Bin bin1 = new Bin("age", profile.age);
Bin bin2 = new Bin("isMale", profile.isMale);
client.put(writePolicy, kk, bin0, bin1, bin2);
}
示例6: writeAerospike
import com.aerospike.client.AerospikeClient; //导入方法依赖的package包/类
@Override
public void writeAerospike(String sessid,
Session session,
AerospikeClient client,
WritePolicy writePolicy,
String namespace,
String setName) throws IOException {
Key kk = new Key(namespace, setName, sessid.toString());
Bin bin0 = new Bin("userid", session.userid);
Bin bin1 = new Bin("start", session.start);
Bin bin2 = new Bin("end", session.end);
Bin bin3 = new Bin("nhits", session.nhits);
client.put(writePolicy, kk, bin0, bin1, bin2, bin3);
}
示例7: toStorage
import com.aerospike.client.AerospikeClient; //导入方法依赖的package包/类
/**
* Take this customer object and write it to the Set.
*/
public int toStorage(AerospikeClient client, String namespace) throws Exception {
int result = 0;
// A slightly strange case where the customerID is BOTH the set name
// and the Key for the customer record.
String setName = this.customerID;
String recordKey = this.customerID;
try {
// Note that custID is BOTH the name of the Aerospike SET and it
// is the KEY of the Singleton Record for Customer info.
Key key = new Key(namespace, setName, recordKey);
Bin custBin = new Bin("custID", customerID);
Bin nameBin = new Bin("name", customerName);
Bin contactBin = new Bin("contact", contactName);
console.debug("Put: namespace(%s) set(%s) key(%s) custID(%s) name(%s) contact(%s)",
key.namespace, key.setName, key.userKey, custBin.value, nameBin.value, contactBin.value );
// Write the Record
client.put(this.writePolicy, key, custBin, nameBin, contactBin );
} catch (Exception e){
e.printStackTrace();
console.warn("Exception: " + e);
result = -1;
}
return result;
}
示例8: toStorage
import com.aerospike.client.AerospikeClient; //导入方法依赖的package包/类
/**
* Take this User Record and write it to the Base Set.
*/
public int toStorage(AerospikeClient client, String namespace) throws Exception {
console.debug("Enter toStorage(): NS(%s)", namespace);
int result = 0;
// Set is the Customer ID, Record Key is the userID.
String setName = this.customerBaseSet;
String recordKey = this.userID;
try {
// Note that custID is BOTH the name of the Aerospike SET and it
// is the KEY of the Singleton Record for Customer info.
Key key = new Key(namespace, setName, recordKey);
Bin custBin = new Bin("custID", this.customerBaseSet);
Bin nameBin = new Bin("name", this.userID);
Bin emailBin = new Bin("email", this.email);
Bin phoneBin = new Bin("phone", this.phone);
Bin addressBin = new Bin("address", this.address);
Bin companyBin = new Bin("company", this.company);
Bin indexBin = new Bin("index", this.index);
console.debug("Put: namespace(%s) set(%s) key(%s) custID(%s) userID(%s)",
key.namespace, key.setName, key.userKey, custBin.value, nameBin.value);
console.debug("Put: Email(%s) phone(%s) addr(%s) company(%s) index(%s)",
emailBin.value, phoneBin.value, addressBin.value, companyBin.value, indexBin.value);
// Write the Record
client.put(this.writePolicy, key, nameBin, emailBin, phoneBin,
addressBin, companyBin, indexBin );
} catch (Exception e){
e.printStackTrace();
console.warn("Exception: " + e);
}
return result;
}
示例9: updateCache
import com.aerospike.client.AerospikeClient; //导入方法依赖的package包/类
/**
* If this User Record is not in the cache, then build a record and write
* it into the cache, along with a CACHE TTL (the cache entries expire
* regularly).
*/
public boolean updateCache(AerospikeClient client, String namespace) throws Exception {
console.debug("Enter toStorage(): NS(%s)", namespace);
boolean recordPresent = false;
// Set is the Customer ID, Record Key is the userID.
String cacheSetName = this.customerCacheSet;
String recordKey = this.userID;
Record record = null;
try {
Key key = new Key(namespace, cacheSetName, recordKey);
// First check to see if this record is present
record = client.get(this.policy, key);
if (record == null) {
// Record is not in the cache, build a new one (from the old
// information) and write it (with the CACHE TTL).
Bin custBin = new Bin("custID", this.customerBaseSet);
Bin nameBin = new Bin("name", this.userID);
Bin emailBin = new Bin("email", this.email);
Bin phoneBin = new Bin("phone", this.phone);
Bin addressBin = new Bin("address", this.address);
Bin companyBin = new Bin("company", this.company);
Bin indexBin = new Bin("index", this.index);
console.debug("Put: namespace(%s) set(%s) key(%s) custID(%s) userID(%s)",
key.namespace, key.setName, key.userKey, custBin.value, nameBin.value);
console.debug("Put: Email(%s) phone(%s) addr(%s) company(%s) index(%s)",
emailBin.value, phoneBin.value, addressBin.value, companyBin.value, indexBin.value);
// Write the Record
client.put(this.cacheWritePolicy, key, nameBin, emailBin, phoneBin,
addressBin, companyBin, indexBin );
// record = client.get(this.policy, key);
// console.info("JUST WROTE AND READ THIS RECORD: namespace(%s) set(%s) key(%s) In CACHE: Rec(%s)",
// key.namespace, key.setName, key.userKey, record.toString());
} else {
console.debug("FOUND: namespace(%s) set(%s) key(%s) In CACHE: Rec(%s)",
key.namespace, key.setName, key.userKey, record.toString());
recordPresent = true;
}
} catch (Exception e){
e.printStackTrace();
console.warn("Exception: " + e);
}
return recordPresent;
}