1.remove dirty cache

main
Gary 9 months ago
parent 43b10cbbde
commit 0168b1d4c5

@ -13,7 +13,6 @@ public class Constants {
public static final String J2CACHE_REGION_JOURNAL_QUERY_PAGE = "journal_query_page"; public static final String J2CACHE_REGION_JOURNAL_QUERY_PAGE = "journal_query_page";
public static final String J2CACHE_REGION_JOURNAL_ID = "journal_id"; public static final String J2CACHE_REGION_JOURNAL_ID = "journal_id";
public static final String J2CACHE_REGION_JOURNAL_NO = "journal_no"; public static final String J2CACHE_REGION_JOURNAL_NO = "journal_no";
public static final String J2CACHE_REGION_JOURNAL_SONG_KEY = "journal_song_key";
public static final String J2CACHE_REGION_JOURNAL_SONG_LIST = "journal_song_list"; public static final String J2CACHE_REGION_JOURNAL_SONG_LIST = "journal_song_list";
public static final String J2CACHE_REGION_JOURNAL_COMMENT_PAGE_HOT = "journal_comment_page_hot"; public static final String J2CACHE_REGION_JOURNAL_COMMENT_PAGE_HOT = "journal_comment_page_hot";

@ -67,6 +67,7 @@ public class CMSJournalController {
@ApiParam(value = "期刊信息", required = true) @RequestBody JournalAddModel updateModel){ @ApiParam(value = "期刊信息", required = true) @RequestBody JournalAddModel updateModel){
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE); cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_ID, id); cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_ID, id);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_SONG_LIST, id);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_NO,journalService.findJournalNoById(id)); cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_NO,journalService.findJournalNoById(id));
return journalService.update(id, updateModel); return journalService.update(id, updateModel);
} }
@ -78,6 +79,7 @@ public class CMSJournalController {
cacheChannel.evict("default", "journal_filter"); cacheChannel.evict("default", "journal_filter");
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE); cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_ID, id); cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_ID, id);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_SONG_LIST, id);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_NO,journalService.findJournalNoById(id)); cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_NO,journalService.findJournalNoById(id));
return journalService.publish(id, queryModel); return journalService.publish(id, queryModel);
} }
@ -88,6 +90,7 @@ public class CMSJournalController {
@ApiParam(value = "期刊启停状态0:停用1:启用", required = true) @RequestBody String state){ @ApiParam(value = "期刊启停状态0:停用1:启用", required = true) @RequestBody String state){
cacheChannel.evict("default", "journal_filter"); cacheChannel.evict("default", "journal_filter");
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_ID, id); cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_ID, id);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_SONG_LIST, id);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_NO,journalService.findJournalNoById(id)); cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_NO,journalService.findJournalNoById(id));
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE); cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE);
return journalService.updateJournalState(id, state); return journalService.updateJournalState(id, state);
@ -98,6 +101,7 @@ public class CMSJournalController {
public Result delete(@ApiParam(value = "期刊ID", required = true) @PathVariable String id){ public Result delete(@ApiParam(value = "期刊ID", required = true) @PathVariable String id){
cacheChannel.evict("default", "journal_filter"); cacheChannel.evict("default", "journal_filter");
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_ID, id); cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_ID, id);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_SONG_LIST, id);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_NO,journalService.findJournalNoById(id)); cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_NO,journalService.findJournalNoById(id));
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE); cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE);
return journalService.deleteById(id); return journalService.deleteById(id);

@ -34,6 +34,7 @@ public class CleanJournalQueryPageListener {
String journalQueryPageKey = getJournalQueryPageKey(optional.get()); String journalQueryPageKey = getJournalQueryPageKey(optional.get());
cacheChannel.evict(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE, journalQueryPageKey); cacheChannel.evict(Constants.J2CACHE_REGION_JOURNAL_QUERY_PAGE, journalQueryPageKey);
cacheChannel.evict(Constants.J2CACHE_REGION_JOURNAL_ID,journalId); cacheChannel.evict(Constants.J2CACHE_REGION_JOURNAL_ID,journalId);
cacheChannel.evict(constants.Constants.J2CACHE_REGION_JOURNAL_SONG_LIST, journalId);
cacheChannel.evict(Constants.J2CACHE_REGION_JOURNAL_NO,optional.get().getJournalNo()); cacheChannel.evict(Constants.J2CACHE_REGION_JOURNAL_NO,optional.get().getJournalNo());
} }

Loading…
Cancel
Save