Redis-jedispoolconfig Configuration

Source: Internet
Author: User
JedisPoolConfig config =  new  JedisPoolConfig();  // Whether the connection is blocked when the connection is exhausted. If it is false, an exception is reported. If it is true, the connection is blocked until it times out. The default value is true. config.setBlockWhenExhausted( true );  // Set the eviction policy class name. The default value is defaultevictionpolicy (when the connection time exceeds the maximum idle time or the number of connections exceeds the maximum number of idle connections) config.setEvictionPolicyClassName( "org.apache.commons.pool2.impl.DefaultEvictionPolicy" );  // Whether to enable the pool JMX management function. The default value is true. config.setJmxEnabled( true );  // Mbean objectname = new objectname ("org. apache. commons. pool2: TYPE = genericobjectpool, name = "+" pool "+ I); Mo thinks that" pool ", JMX is not familiar, but I don't know what it is... the default value is good. config.setJmxNamePrefix( "pool" );  // Whether to enable post-import/export. The default value is true. config.setLifo( true );  // Maximum number of idle connections. The default value is 8. config.setMaxIdle( 8 );  // Maximum number of connections. The default value is 8. config.setMaxTotal( 8 );  // Obtain the maximum number of waiting milliseconds for the connection (if blockwhenexhausted is set to block). If it times out, an exception is thrown. If it is less than zero, the default value is-1. config.setMaxWaitMillis(- 1 );  // The minimum idle time of the eviction connection is 1800000 milliseconds by default (30 minutes) config.setMinEvictableIdleTimeMillis( 1800000 );  // The minimum number of idle connections. The default value is 0. config.setMinIdle( 0 );  // The maximum number of evicted objects during each eviction check. If the value is negative, 1/ABS (n). The default value is 3. config.setNumTestsPerEvictionRun( 3 );  // How long will the object be evicted after it is idle? If the idle time is greater than this value and the idle connection is greater than the maximum number of idle connections, the object will be evicted without being determined based on minevictableidletimemillis (default eviction policy) config.setSoftMinEvictableIdleTimeMillis( 1800000 );  // Check the validity when obtaining the connection. The default value is false. config.setTestOnBorrow( false );  // Check validity when idle. The default value is false. config.setTestWhileIdle( false );  // The time interval (in milliseconds) of the eviction scan. If the value is negative, the eviction thread is not run. The default value is-1. config.setTimeBetweenEvictionRunsMillis(- 1 );  JedisPool pool =  new  JedisPool(config,  "localhost", );Int timeout = 3000; new jedissentinelpool (master, sentinels, poolconfig, timeout); // timeout read timeout

Redis-jedispoolconfig Configuration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.