Tabnine Logo
KetamaMemcachedSessionLocator.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
net.rubyeye.xmemcached.impl.KetamaMemcachedSessionLocator
constructor

Best Java code snippets using net.rubyeye.xmemcached.impl.KetamaMemcachedSessionLocator.<init> (Showing top 3 results out of 315)

origin: heibaiying/spring-samples-for-all

@Bean
public MemcachedClient memcachedClientForCluster() {
  List<InetSocketAddress> addressList = new ArrayList<InetSocketAddress>();
  addressList.add(new InetSocketAddress("192.168.200.201", 11211));
  addressList.add(new InetSocketAddress("192.168.200.201", 11212));
  // 赋予权重
  int[] weights = {1, 2};
  XMemcachedClientBuilder builder = new XMemcachedClientBuilder(addressList, weights);
  // 设置连接池大小
  builder.setConnectionPoolSize(10);
  // 协议工厂
  builder.setCommandFactory(new TextCommandFactory());
  // 分布策略,一致性哈希KetamaMemcachedSessionLocator或者ArraySessionLocator(默认)
  builder.setSessionLocator(new KetamaMemcachedSessionLocator());
  // 设置序列化器
  builder.setTranscoder(new SerializingTranscoder());
  MemcachedClient memcachedClient = null;
  try {
    memcachedClient = builder.build();
  } catch (IOException e) {
    e.printStackTrace();
  }
  return memcachedClient;
}
origin: heibaiying/spring-samples-for-all

public MemcachedClient memcachedClientForCluster() {
  List<InetSocketAddress> addressList = new ArrayList<>();
  addressList.add(new InetSocketAddress("192.168.0.108", 11211));
  addressList.add(new InetSocketAddress("192.168.0.108", 11212));
  // 赋予权重
  int[] weights = {1, 2};
  XMemcachedClientBuilder builder = new XMemcachedClientBuilder(addressList, weights);
  // 设置连接池大小
  builder.setConnectionPoolSize(10);
  // 协议工厂
  builder.setCommandFactory(new TextCommandFactory());
  // 分布策略,一致性哈希KetamaMemcachedSessionLocator或者ArraySessionLocator(默认)
  builder.setSessionLocator(new KetamaMemcachedSessionLocator());
  // 设置序列化器
  builder.setTranscoder(new SerializingTranscoder());
  MemcachedClient memcachedClient = null;
  try {
    memcachedClient = builder.build();
  } catch (IOException e) {
    e.printStackTrace();
  }
  return memcachedClient;
}
origin: ragnor/simple-spring-memcached

builder.setSessionLocator(new KetamaMemcachedSessionLocator());
net.rubyeye.xmemcached.implKetamaMemcachedSessionLocator<init>

Javadoc

Create a KetamaMemcachedSessionLocator with default config.

Popular methods of KetamaMemcachedSessionLocator

  • buildMap
  • getSessionByHash
  • getSessionList
  • getSockStr
  • nextHash

Popular in Java

  • Running tasks concurrently on multiple threads
  • setRequestProperty (URLConnection)
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now