MCPcopy Create free account
hub / github.com/Thecosy/Ice-chat / GetRedisData

Class GetRedisData

src/main/java/com/ninespace/sqlite/task/GetRedisData.java:16–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14import java.util.Map;
15
16@Component
17public class GetRedisData {
18
19 @Resource
20 private UserMapper userMapper;
21
22 @Resource
23 private RedisUtil redisUtils;
24
25 public void getData(){
26 System.out.println("开启刷新热点数据");
27 //系统启动中。。。从数据库获取值
28// List<User> users = userMapper.selectList(null);
29// for (User user : users) {
30// //存入redis,以便于后面都从redis获取值,而不是每次从数据库直接查询
31// redisUtils.set(user.getUsername(),user.getProfile());
32// }
33 }
34
35 @PreDestroy
36 public void destroy() {
37 //系统运行结束
38 }
39
40 @Scheduled(cron = "0/60 0/1 * * * ? ")
41 public void getDataSchedul() {
42 //每隔10秒执行一次
43 getData();
44 }
45
46}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected