提交 2b37339b authored 作者: zjm's avatar zjm

合并分支 'bug' 到 'master'

fix(装备模块): 修改更新缓存的bug 查看合并请求 !35
...@@ -3,7 +3,6 @@ package com.tykj.dev.device.library.service; ...@@ -3,7 +3,6 @@ package com.tykj.dev.device.library.service;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* DATE:2021-8-11 * DATE:2021-8-11
...@@ -24,4 +23,7 @@ public interface DeviceLibraryCacheService { ...@@ -24,4 +23,7 @@ public interface DeviceLibraryCacheService {
*/ */
List<DeviceLibrary> findByIds(List<Integer> ids); List<DeviceLibrary> findByIds(List<Integer> ids);
void deletAllDeviceLibraryList();
} }
...@@ -3,9 +3,10 @@ package com.tykj.dev.device.library.service.impl; ...@@ -3,9 +3,10 @@ package com.tykj.dev.device.library.service.impl;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService; import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import jdk.nashorn.internal.ir.IfNode;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -55,4 +56,12 @@ public class CacheLibraryServiceImpl implements DeviceLibraryCacheService { ...@@ -55,4 +56,12 @@ public class CacheLibraryServiceImpl implements DeviceLibraryCacheService {
); );
return libraryList; return libraryList;
} }
@Override
@CacheEvict(key = "'device'",allEntries=true)
public void deletAllDeviceLibraryList() {
// long l = System.currentTimeMillis();
// List<DeviceLibrary> all = deviceLibraryDao.findAll();
// System.out.println("更新缓存时间"+(System.currentTimeMillis()-l));
}
} }
...@@ -22,6 +22,7 @@ public class DevideTask { ...@@ -22,6 +22,7 @@ public class DevideTask {
@Scheduled(cron = "30 * * * * ? ") @Scheduled(cron = "30 * * * * ? ")
private void signUpDeadline() { private void signUpDeadline() {
log.info("定时device更新缓存开始"); log.info("定时device更新缓存开始");
deviceLibraryCacheService.deletAllDeviceLibraryList();
deviceLibraryCacheService.getAllDeviceLibraryList(); deviceLibraryCacheService.getAllDeviceLibraryList();
log.info("定时device更新缓存结束"); log.info("定时device更新缓存结束");
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论