yujian
2019-05-20 33033679c498f1493e93b8c111fbb27b48d743de
动态添加缓存
3个文件已修改
11 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/DynamicInfoServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/dynamic/DynamicInfoService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/ehcache.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/DynamicInfoServiceImpl.java
@@ -9,6 +9,7 @@
import javax.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
import org.yeshi.utils.DateUtil;
@@ -342,11 +343,13 @@
    }
    @Override
    @Cacheable(value = "dynamicCache", key = "'count-'+#cid+'-'+#subId")
    public long count(Long cid, Long subId) {
        return dynamicInfoDao.count(cid, subId);
    }
    @Override
    @Cacheable(value = "dynamicCache", key = "'query-'+#start+'-'+#count+'-'+#cid+'-'+#subId")
    public List<DynamicInfo> query(int start, int count, Long cid, Long subId) {
        List<DynamicInfo> list = dynamicInfoDao.query(start, count, cid, subId);
        
fanli/src/main/java/com/yeshi/fanli/service/inter/dynamic/DynamicInfoService.java
@@ -50,7 +50,7 @@
     */
    public void insertInviteMaterial(String content, String picUrl, Long activityId, ActivityUser activityUser);
    void insert(DynamicInfo record);
    public void insert(DynamicInfo record);
    public long count(Long cid, Long subId);
fanli/src/main/resource/ehcache.xml
@@ -190,4 +190,10 @@
        maxElementsOnDisk="10000" eternal="false" timeToIdleSeconds="120"
        timeToLiveSeconds="120" overflowToDisk="true"
        memoryStoreEvictionPolicy="LRU" />    
    <!--动态缓存 -->
    <cache name="dynamicCache" maxElementsInMemory="1000"
        maxElementsOnDisk="10000" eternal="false" timeToIdleSeconds="120"
        timeToLiveSeconds="120" overflowToDisk="true"
        memoryStoreEvictionPolicy="LRU" />
</ehcache>