redis.clients.util
Class Sharded<R,S extends ShardInfo<R>>

java.lang.Object
  extended by redis.clients.util.Sharded<R,S>
Direct Known Subclasses:
BinaryShardedJedis

public class Sharded<R,S extends ShardInfo<R>>
extends java.lang.Object


Field Summary
static java.util.regex.Pattern DEFAULT_KEY_TAG_PATTERN
           
static int DEFAULT_WEIGHT
           
 
Constructor Summary
Sharded(java.util.List<S> shards)
           
Sharded(java.util.List<S> shards, Hashing algo)
           
Sharded(java.util.List<S> shards, Hashing algo, java.util.regex.Pattern tagPattern)
           
Sharded(java.util.List<S> shards, java.util.regex.Pattern tagPattern)
           
 
Method Summary
 java.util.Collection<S> getAllShardInfo()
           
 java.util.Collection<R> getAllShards()
           
 java.lang.String getKeyTag(java.lang.String key)
          A key tag is a special pattern inside a key that, if preset, is the only part of the key hashed in order to select the server for this key.
 R getShard(byte[] key)
           
 R getShard(java.lang.String key)
           
 S getShardInfo(byte[] key)
           
 S getShardInfo(java.lang.String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WEIGHT

public static final int DEFAULT_WEIGHT
See Also:
Constant Field Values

DEFAULT_KEY_TAG_PATTERN

public static final java.util.regex.Pattern DEFAULT_KEY_TAG_PATTERN
Constructor Detail

Sharded

public Sharded(java.util.List<S> shards)

Sharded

public Sharded(java.util.List<S> shards,
               Hashing algo)

Sharded

public Sharded(java.util.List<S> shards,
               java.util.regex.Pattern tagPattern)

Sharded

public Sharded(java.util.List<S> shards,
               Hashing algo,
               java.util.regex.Pattern tagPattern)
Method Detail

getShard

public R getShard(byte[] key)

getShard

public R getShard(java.lang.String key)

getShardInfo

public S getShardInfo(byte[] key)

getShardInfo

public S getShardInfo(java.lang.String key)

getKeyTag

public java.lang.String getKeyTag(java.lang.String key)
A key tag is a special pattern inside a key that, if preset, is the only part of the key hashed in order to select the server for this key.

Parameters:
key -
Returns:
The tag if it exists, or the original key
See Also:
'm_using_some_form_of_key_hashing_for_partitioning,_but_wh

getAllShardInfo

public java.util.Collection<S> getAllShardInfo()

getAllShards

public java.util.Collection<R> getAllShards()