你的位置:首页 > 软件开发 > Java > 第九章 企业项目开发

第九章 企业项目开发

发布时间:2016-01-28 20:00:13
注意:本章代码将会建立在上一章的代码基础上,上一章链接《第八章 企业项目开发--分布式缓存memcached》1、为什么用Redis1.1、为什么用分布式缓存(或者说本地缓存存在的问题)?见《第八章 企业项目开发--分布式缓存memcached》1.2、有了memcached,为 ...

第九章 企业项目开发

注意:本章代码将会建立在上一章的代码基础上,上一章链接《第八章 企业项目开发--分布式缓存memcached》

1、为什么用Redis

1.1、为什么用分布式缓存(或者说本地缓存存在的问题)?

  • 见《第八章 企业项目开发--分布式缓存memcached》

1.2、有了memcached,为什么还要用redis?

  • 见《第一章 常用的缓存技术》

 

2、代码实现

2.1、ssmm0

第九章 企业项目开发

pom.

只在dev环境下添加了以下代码:

第九章 企业项目开发第九章 企业项目开发
        <!--           redis:多台服务器支架用什么符号隔开无所谓,只要在程序中用相应的符号去分隔就好。          这里只配置了一个redis.servers,如果系统特别大的时候,可以为每一种业务或某几种业务配置一个redis.xxx.servers         -->        <redis.servers><![CDATA[127.0.0.1:6379]]></redis.servers>        <!--           下边各个参数的含义在RedisFactory.java中有介绍,          当我们三种环境(dev/rc/prod)下的一些参数都相同时,可以将这些参数直接设置到cache_conf.properties文件中去        -->        <redis.timeout>2000</redis.timeout><!-- 操作超时时间:2s,单位:ms -->        <redis.conf.lifo>true</redis.conf.lifo>        <redis.conf.maxTotal>64</redis.conf.maxTotal>        <redis.conf.blockWhenExhausted>true</redis.conf.blockWhenExhausted>        <redis.conf.maxWaitMillis>-1</redis.conf.maxWaitMillis>                <redis.conf.testOnBorrow>false</redis.conf.testOnBorrow>        <redis.conf.testOnReturn>false</redis.conf.testOnReturn>                <!-- 空闲连接相关 -->        <redis.conf.maxIdle>8</redis.conf.maxIdle>        <redis.conf.minIdle>0</redis.conf.minIdle>        <redis.conf.testWhileIdle>true</redis.conf.testWhileIdle>        <redis.conf.timeBetweenEvictionRunsMillis>30000</redis.conf.timeBetweenEvictionRunsMillis><!-- 30s -->        <redis.conf.numTestsPerEvictionRun>8</redis.conf.numTestsPerEvictionRun>        <redis.conf.minEvictableIdleTimeMillis>60000</redis.conf.minEvictableIdleTimeMillis><!-- 60s -->

原标题:第九章 企业项目开发

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录