Authored by mlge

鉴定结果查询--缓存修改

@@ -230,7 +230,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ @@ -230,7 +230,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
230 } 230 }
231 result = productChainMapper.selectByTagId(tagId); 231 result = productChainMapper.selectByTagId(tagId);
232 if(result != null){ 232 if(result != null){
233 - clientCache.set(kb.getKey(), 10 * 60 , result );//10分钟 233 + clientCache.setEx(kb, result,10 * 60 );//10分钟
234 } 234 }
235 logger.info("queryTransactionIdByTagId from db success! tagId={},result={}", tagId,result); 235 logger.info("queryTransactionIdByTagId from db success! tagId={},result={}", tagId,result);
236 return result; 236 return result;
@@ -288,7 +288,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ @@ -288,7 +288,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
288 result = identifyRelationMapper.selectByauthUid(authUid); 288 result = identifyRelationMapper.selectByauthUid(authUid);
289 289
290 if(result != null){ 290 if(result != null){
291 - clientCache.set(kb.getKey(), 2 * 60 * 60, result );//两小时 291 + clientCache.setEx(kb, result, 2 * 60 * 60 );//两小时
292 } 292 }
293 return result; 293 return result;
294 } 294 }
@@ -304,7 +304,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ @@ -304,7 +304,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
304 } 304 }
305 result = identifyRecordsMapper.selectByTagAndNfcId(tagId, nfcUid); 305 result = identifyRecordsMapper.selectByTagAndNfcId(tagId, nfcUid);
306 if(result != null){ 306 if(result != null){
307 - clientCache.set(kb.getKey(), 5 * 60, result ); 307 + clientCache.setEx(kb, result, 5 * 60 );
308 } 308 }
309 return result; 309 return result;
310 } 310 }
@@ -319,13 +319,13 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ @@ -319,13 +319,13 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
319 319
320 RedisKeyBuilder kb = new RedisKeyBuilder().appendFixed("ufo:product:identifyResultInfo:"). 320 RedisKeyBuilder kb = new RedisKeyBuilder().appendFixed("ufo:product:identifyResultInfo:").
321 appendVar(tagId).appendVar(":").appendVar(nfcUid); 321 appendVar(tagId).appendVar(":").appendVar(nfcUid);
322 - clientCache.set(kb.getKey(), 5 * 60, result ); 322 + clientCache.setEx(kb, result,5 * 60 );
323 } 323 }
324 324
325 private ProductIdentifyResp getIdentifyFromCache(String tagId, String nfcUid) { 325 private ProductIdentifyResp getIdentifyFromCache(String tagId, String nfcUid) {
326 RedisKeyBuilder kb = new RedisKeyBuilder().appendFixed("ufo:product:identifyResultInfo:"). 326 RedisKeyBuilder kb = new RedisKeyBuilder().appendFixed("ufo:product:identifyResultInfo:").
327 appendVar(tagId).appendVar(":").appendVar(nfcUid); 327 appendVar(tagId).appendVar(":").appendVar(nfcUid);
328 - ProductIdentifyResp identifyResp = clientCache.get(kb.getKey(), ProductIdentifyResp.class); 328 + ProductIdentifyResp identifyResp = clientCache.get(kb, ProductIdentifyResp.class);
329 return identifyResp; 329 return identifyResp;
330 } 330 }
331 331