首页 > 编程语言 > 详细

缓存,spring

时间:2015-01-19 12:43:08      阅读:195      评论:0      收藏:0      [点我收藏+]

applicationcontext.xml

xmlns:cache="http://www.springframework.org/schema/cache"

xsi:schemaLocation=http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd

<cache:annotation-driven cache-manager="cache"/>

<bean id="cache" class="org.springframework.cache.support.SimpleCacheManager">
        <property name="caches">
            <list>
                <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean"  p:name="qus"></bean>
                <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean"  p:name="clo"></bean>
            </list>
        </property>
    </bean>

业务层

方法上面实现@Cacheable("clo")

例如:

@Cacheable("clo")
    public List<Clothingcategory> cFindAll() {
        return clothingcategoryDAO.findAll();
    }

切记:clo是在bean在配置的,请看上面

缓存,spring

原文:http://www.cnblogs.com/danmao/p/4233288.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!