缓存,spring
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在配置的,请看上面