Java Records-SPRINGMVC integrated Redis

Source: Internet
Author: User
Tags time in milliseconds

1.redis.properties
#主机地址redis. host=127.0.0.1# port number redis.port=6379# The maximum wait time in milliseconds when there are no returned objects in the pool redis.pool.maxwaitmillis=10000# Maximum number of connections redis.pool.maxtotal=300# the maximum number of objects that can hold the Idel idle state  redis.pool.maxidle=20# The minimum number  of objects that can maintain Idel idle state redis.pool.minidle=5# if the Borrow object method is called, the validity check is performed   redis.pool.testonborrow=true# when the return object method is called, the Whether the validity check   redis.pool.testonreturn=true# Timeout redis.timeout=15000# whether to use the pool redis.usepool=true# "idle link" to detect the thread, the period of detection, the number of milliseconds. A negative value indicates that the detection thread is not running. The default is -1.  redis.pool.timebetweenevictionrunsmillis=30000# whether to detect its idle timeout when outputting a "linked" object to the caller;  Redis.pool.testwhileidle=true  # The number of linked resources detected each time for the "Idle link" detection thread. The default is 3.  
2.spring-redis.xml
<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xmlns:p= "http://www.springframework.org/schema/p"Xmlns:context= "Http://www.springframework.org/schema/context"Xmlns:mvc= "Http://www.springframework.org/schema/mvc"xsi:schemalocation= "Http://www.springframework.org/schema/beans Http://www.springframework.org/schema/beans                              /spring-beans-4.0.xsd Http://www.springframework.org/schema/context Http://www.springframework.org/schema/context/spring-context-4.0.xsd Http://www.springfra Mework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd ">    <Context:component-scanBase-package= "Com.net.xinfang" />    <Context:property-placeholder Location= "Classpath:redis.properties"ignore-unresolvable= "true"/>       <!--configuration of the Redis connection pool -    <BeanID= "Jedispoolconfig"class= "Redis.clients.jedis.JedisPoolConfig">      < Propertyname= "Maxtotal"value= "${redis.pool.maxtotal}" />      < Propertyname= "Maxidle"value= "${redis.pool.maxidle}" />      < Propertyname= "Minidle"value= "${redis.pool.minidle}" />      < Propertyname= "Maxwaitmillis"value= "${redis.pool.maxwaitmillis}" />      < Propertyname= "Testonborrow"value= "${redis.pool.testonborrow}"/>      < Propertyname= "Testonreturn"value= "${redis.pool.testonreturn}"/>    </Bean>    <!--Factory class Configuration -    <BeanID= "Jedisconnectionfactory"class= "Org.springframework.data.redis.connection.jedis.JedisConnectionFactory">        < Propertyname= "HostName"value= "${redis.host}" />        < Propertyname= "Port"value= "${redis.port}" />        < Propertyname= "Poolconfig"ref= "Jedispoolconfig" />        < Propertyname= "Timeout"value= "${redis.timeout}"></ Property>         < Propertyname= "Usepool"value= "${redis.usepool}"></ Property>     </Bean>    <BeanID= "Jedistemplate"class= "Org.springframework.data.redis.core.RedisTemplate">     < Propertyname= "ConnectionFactory"ref= "Jedisconnectionfactory"></ Property>     < Propertyname= "Keyserializer">     <Beanclass= "Org.springframework.data.redis.serializer.StringRedisSerializer"/>     </ Property>     < Propertyname= "ValueSerializer">     <Beanclass= "Org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>   </ Property>  </Bean> </Beans>

Java Records-SPRINGMVC integrated Redis

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.