public class ConsistentKeyHasher extends Object implements KeyHasher
Constructor and Description |
---|
ConsistentKeyHasher(AsyncRedisConnection[] pconnections)
Creates a Consistent Key Hasher with 180 hashes per connection and CRC_HASH as the Hash Algorithm.
|
ConsistentKeyHasher(AsyncRedisConnection[] pconnections,
int phashesPerConnection,
HashAlgorithm phashAlg)
Creates a Consistent Key Hasher.
|
Modifier and Type | Method and Description |
---|---|
int |
getConnectionIndex(String key,
AsyncRedisConnection[] pconnections,
boolean useOnlyActive)
Returns the connection index for a key
|
public ConsistentKeyHasher(AsyncRedisConnection[] pconnections, int phashesPerConnection, HashAlgorithm phashAlg)
pconnections
- connections to pick one fromphashesPerConnection
- Number of Hashcodes to generate for each connectionphashAlg
- Hash Algorithm to generate the hash codes of the key and the serverspublic ConsistentKeyHasher(AsyncRedisConnection[] pconnections)
pconnections
- connections to pick one frompublic int getConnectionIndex(String key, AsyncRedisConnection[] pconnections, boolean useOnlyActive)
KeyHasher
getConnectionIndex
in interface KeyHasher
key
- key to assign the connection indexpconnections
- Connections to pick fromuseOnlyActive
- True if only active connections are to be picked. Usually true is passed by ShardedAsyncRedisClient.Copyright © 2013- Suresh Mahalingam. All Rights Reserved.