Browse Source

缓存5分钟

linxk 3 tuần trước cách đây
mục cha
commit
da71c1955f

+ 1 - 0
cif-service/src/main/java/com/txz/cif/core/cache/CacheType.java

@@ -12,6 +12,7 @@ public enum CacheType {
 	AppSecretKey,
 
 	Top2,
+	Top3,
 
 	sjtcRefundCallback,
 

+ 2 - 2
cif-service/src/main/java/com/txz/cif/web/RedEnvelopeApiController.java

@@ -103,7 +103,7 @@ public class RedEnvelopeApiController {
 	@GetMapping("/top")
 	@ApiOperation(value = "排行榜type 1 7天收益排行",httpMethod = "GET")
 	public Result<TopBO> top(@RequestParam(defaultValue = "1") Integer type, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
-		String key = CacheKey.generateKey(CacheType.Top2,type+":"+page+":"+size).toString();
+		String key = CacheKey.generateKey(CacheType.Top3,type+":"+page+":"+size).toString();
 		Object o = redisUtil.get(key);
 		if (o != null){
 			return ResultGenerator.genSuccessResult(JSONUtil.toBean(o.toString(),TopBO.class));
@@ -136,7 +136,7 @@ public class RedEnvelopeApiController {
 		}).collect(Collectors.toList()));
 		bo.setUsers(pageInfo);
 		bo.setUpdateTime(DateUtil.date());
-		redisUtil.set(key,JSONUtil.toJsonStr(pageInfo),1, TimeUnit.DAYS);
+		redisUtil.set(key,JSONUtil.toJsonStr(pageInfo),5, TimeUnit.MINUTES);
 		return ResultGenerator.genSuccessResult(pageInfo);
 	}
 }