parent
3a91aa3087
commit
a27e1cf64c
6 changed files with 91 additions and 18 deletions
@ -0,0 +1,64 @@ |
||||
/* |
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* Neither the name of the dreamlu.net developer nor the names of its |
||||
* contributors may be used to endorse or promote products derived from |
||||
* this software without specific prior written permission. |
||||
* Author: Chill 庄骞 (smallchill@163.com) |
||||
*/ |
||||
package org.springblade.common.cache.business; |
||||
|
||||
import org.springblade.common.constant.BusinessConstant; |
||||
import org.springblade.common.enums.DictBizEnum; |
||||
import org.springblade.core.cache.utils.CacheUtil; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springblade.core.tool.utils.SpringUtil; |
||||
import org.springblade.core.tool.utils.StringPool; |
||||
import org.springblade.modules.business.entity.CupImg; |
||||
import org.springblade.modules.business.service.ICupImgService; |
||||
import org.springblade.modules.system.entity.DictBiz; |
||||
|
||||
import java.util.List; |
||||
|
||||
import static org.springblade.core.cache.constant.CacheConstant.DICT_CACHE; |
||||
|
||||
/** |
||||
* 用户头像缓存工具类 |
||||
* |
||||
* @author Chill |
||||
*/ |
||||
public class CupImgCache { |
||||
|
||||
private static final String CUP_CACHE = "blade:cup"; |
||||
|
||||
private static final String IMG_VALUE = "img:cardno"; |
||||
|
||||
private static final ICupImgService cupImgService; |
||||
|
||||
static { |
||||
cupImgService = SpringUtil.getBean(ICupImgService.class); |
||||
} |
||||
|
||||
/** |
||||
* 获取实体 |
||||
* |
||||
* @param cardNo 身份证号 |
||||
* @return CupImg |
||||
*/ |
||||
public static CupImg getByCardNo(String cardNo) { |
||||
return CacheUtil.get(CUP_CACHE, IMG_VALUE, cardNo, () -> cupImgService.getByCardNo(cardNo), BusinessConstant.TENANT_MODE); |
||||
} |
||||
|
||||
|
||||
public static void clearCupImgCache(String cardNo) { |
||||
CacheUtil.evict(CUP_CACHE, IMG_VALUE, cardNo, BusinessConstant.TENANT_MODE); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue