public MemcachedNode getPrimary(final String k) { MemcachedNode rv = getNodeForKey(hashAlg.hash(k)); assert rv != null : "Found no node for key " + k; return rv; }
public MemcachedNode getPrimary(String k) { if (partialStringHash.get()) { final int index = k.indexOf(hashDelimiter.get()); if (index > 0) { k = k.substring(0, index); } } final long _hash = hashingAlgorithm.hash(k); Long hash = Long.valueOf(_hash); hash = ketamaNodes.ceilingKey(hash); if (hash == null) { hash = ketamaNodes.firstKey(); } return ketamaNodes.get(hash); }
final Long hashL = Long.valueOf(hashingAlgorithm.hash(config.getKeyForNode(node, i))); newNodeMap.put(hashL, node);
newNodeMap.put(hashAlg.hash(config.getKeyForNode(node, i)), node);
private void nextHash() { // this.calculateHash(Integer.toString(tries)+key).hashCode(); long tmpKey = hashAlg.hash((numTries++) + key); // This echos the implementation of Long.hashCode() hashVal += (int) (tmpKey ^ (tmpKey >>> 32)); hashVal &= 0xffffffffL; /* truncate to 32-bits */ remainingTries--; }
private void nextHash() { // this.calculateHash(Integer.toString(tries)+key).hashCode(); long tmpKey = hashAlg.hash((numTries++) + key); // This echos the implementation of Long.hashCode() hashVal += (int) (tmpKey ^ (tmpKey >>> 32)); hashVal &= 0xffffffffL; /* truncate to 32-bits */ remainingTries--; }
private void nextHash() { // this.calculateHash(Integer.toString(tries)+key).hashCode(); long tmpKey = hashAlg.hash((numTries++) + key); // This echos the implementation of Long.hashCode() hashVal += (int) (tmpKey ^ (tmpKey >>> 32)); hashVal &= 0xffffffffL; /* truncate to 32-bits */ remainingTries--; }
@Override public int getVbucketByKey(String key) { int digest = (int) hashAlgorithm.hash(key); return digest & mask; }
public ReplKetamaIterator(final String k, ReplicaPick p, final int t) { super(); hashVal = hashAlg.hash(k); remainingTries = t; key = k; pick = p; }
public KetamaIterator(final String k, final int t) { super(); hashVal = hashAlg.hash(k); remainingTries = t; key = k; }
public KetamaIterator(final String k, final int t) { super(); hashVal = hashAlg.hash(k); remainingTries = t; key = k; }
private int getServerForKey(String key) { int rv = (int) (hashAlg.hash(key) % nodes.length); assert rv >= 0 : "Returned negative key for key " + key; assert rv < nodes.length : "Invalid server number " + rv + " for key " + key; return rv; }
private void nextHash() { // this.calculateHash(Integer.toString(tries)+key).hashCode(); long tmpKey = hashAlg.hash((numTries++) + key); // This echos the implementation of Long.hashCode() hashVal += (int) (tmpKey ^ (tmpKey >>> 32)); hashVal &= 0xffffffffL; /* truncate to 32-bits */ remainingTries--; }
private void nextHash() { long tmpKey = hashAlg.hash((numTries++) + key); // This echos the implementation of Long.hashCode() hashVal += (int) (tmpKey ^ (tmpKey >>> 32)); hashVal &= 0xffffffffL; /* truncate to 32-bits */ remainingTries--; }
private int getServerForKey(String key) { int rv = (int) (hashAlg.hash(key) % nodes.length); assert rv >= 0 : "Returned negative key for key " + key; assert rv < nodes.length : "Invalid server number " + rv + " for key " + key; return rv; }
public MemcachedNode getPrimary(final String k) { MemcachedNode rv=getNodeForKey(hashAlg.hash(k)); assert rv != null : "Found no node for key " + k; return rv; }
public MemcachedNode getPrimary(final String k) { MemcachedNode rv = getNodeForKey(hashAlg.hash(k)); assert rv != null : "Found no node for key " + k; return rv; }
public MemcachedNode getPrimary(final String k) { MemcachedNode rv=getNodeForKey(hashAlg.hash(k)); assert rv != null : "Found no node for key " + k; return rv; }
public MemcachedNode getPrimary(final String k) { MemcachedNode rv = getNodeForKey(hashAlg.hash(k)); assert rv != null : "Found no node for key " + k; return rv; }
public MemcachedNode getPrimary(final String k) { MemcachedNode rv = getNodeForKey(hashAlg.hash(k)); assert rv != null : "Found no node for key " + k; return rv; }