net.spy.memcached.HashAlgorithm Java Examples

The following examples show how to use net.spy.memcached.HashAlgorithm. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EVCacheNodeLocator.java    From EVCache with Apache License 2.0 6 votes vote down vote up
/**
 * Create a new KetamaNodeLocator using specified nodes and the specifed
 * hash algorithm and configuration.
 *
 * @param nodes
 *            The List of nodes to use in the Ketama consistent hash
 *            continuum
 * @param alg
 *            The hash algorithm to use when choosing a node in the Ketama
 *            consistent hash continuum
 * @param conf
 */
public EVCacheNodeLocator(EVCacheClient client, List<MemcachedNode> nodes, HashAlgorithm alg, KetamaNodeLocatorConfiguration conf) {
    super();
    this.allNodes = nodes;
    this.hashingAlgorithm = alg;
    this.config = conf;
    this.client = client;

    this.partialStringHash = EVCacheConfig.getInstance().getPropertyRepository().get(client.getAppName() + "." + client.getServerGroupName() + ".hash.on.partial.key", Boolean.class)
            .orElseGet(client.getAppName()+ ".hash.on.partial.key").orElse(false);
    this.hashDelimiter = EVCacheConfig.getInstance().getPropertyRepository().get(client.getAppName() + "." + client.getServerGroupName() + ".hash.delimiter", String.class)
            .orElseGet(client.getAppName() + ".hash.delimiter").orElse(":");


    setKetamaNodes(nodes);
}
 
Example #2
Source File: EVCacheNodeLocator.java    From EVCache with Apache License 2.0 5 votes vote down vote up
private EVCacheNodeLocator(EVCacheClient client, TreeMap<Long, MemcachedNode> smn, Collection<MemcachedNode> an, HashAlgorithm alg, KetamaNodeLocatorConfiguration conf) {
    super();
    this.ketamaNodes = smn;
    this.allNodes = an;
    this.hashingAlgorithm = alg;
    this.config = conf;
    this.client = client;

    this.partialStringHash = EVCacheConfig.getInstance().getPropertyRepository().get(client.getAppName() + "." + client.getServerGroupName() + ".hash.on.partial.key", Boolean.class)
            .orElseGet(client.getAppName()+ ".hash.on.partial.key").orElse(false);
    this.hashDelimiter = EVCacheConfig.getInstance().getPropertyRepository().get(client.getAppName() + "." + client.getServerGroupName() + ".hash.delimiter", String.class)
            .orElseGet(client.getAppName() + ".hash.delimiter").orElse(":");
}
 
Example #3
Source File: MemcachedConnectionFactory.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public HashAlgorithm getHashAlg() {
    return underlying.getHashAlg();
}
 
Example #4
Source File: MemcachedConnectionFactory.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public HashAlgorithm getHashAlg() {
    return underlying.getHashAlg();
}
 
Example #5
Source File: BaseConnectionFactory.java    From EVCache with Apache License 2.0 4 votes vote down vote up
public HashAlgorithm getHashAlg() {
    return super.getHashAlg();
}
 
Example #6
Source File: BaseAsciiConnectionFactory.java    From EVCache with Apache License 2.0 4 votes vote down vote up
public HashAlgorithm getHashAlg() {
    return super.getHashAlg();
}