首页  

aerospike key 说明     所属分类 aerospike 浏览量 1527
aerospike默认不会存原始key 

aerospike-client-4.0.8.jar
com.aerospike.client.Key

public final class Key {	
	// Namespace. Equivalent to database name.
	public final String namespace;
	
	// Optional set name. Equivalent to database table.
	public final String setName;
	
	
	// Unique server hash value generated from set name and user key.
	public final byte[] digest;
	
	// Original user key. This key is immediately converted to a hash digest.
	// This key is not used or returned by the server by default.
	public final Value userKey;
	


public Key(String namespace, String setName, String key) throws AerospikeException {
		this.namespace = namespace; 
		this.setName = setName;
		this.userKey = new Value.StringValue(key);
		digest = computeDigest(setName, this.userKey);
}
	
	
保存原始key可以使用两种方式

Set "WritePolicy.sendKey" to true. 
In this case, the key will be sent to the server for storage on writes 
and retrieved on multi-record scans and queries.
设置 WritePolicy.sendKey 为 true
	 
	
Explicitly store and retrieve the key in a bin
把key写入到某个列

	
public static byte[] computeDigest(String setName, Value key) throws AerospikeException

Generate unique server hash value from set name, key type and user defined key.  
The hash function is RIPEMD-160 (a 160 bit hash).

160位的hash值

上一篇     下一篇
kubernetes2018

开源监控系统介绍

graphite概述

史上最强最骚程序员简历

linux中利用CGroup限制进程资源

hadoop1.0与2.0的区别