当前位置: 首页 > news >正文

营销网站设计公司今日新闻最新头条

营销网站设计公司,今日新闻最新头条,动漫制作和动漫设计的区别,湖南网站建设seo优化项目中,用于缓存姓名、地名、单位名称等一些较固定名称的id-name小组件。用于减少一些表的关连操作和冗余字段。优化代码结构。扩展也方便,写不同的枚举就行了。 具体用法: {NameCacheUser.USER.getName(userId);NameCacheUser.ACCOUNT.getN…

项目中,用于缓存姓名、地名、单位名称等一些较固定名称的id-name小组件。用于减少一些表的关连操作和冗余字段。优化代码结构。扩展也方便,写不同的枚举就行了。
具体用法:

{NameCacheUser.USER.getName(userId);NameCacheUser.ACCOUNT.getName(accountId);NameCacheUser.OFFICE.getName(officeId);
}
public enum NameCacheUser implements NameCacheBee {USER(userId -> {UserMapper userMapper = ZYSpringUtils.getBean(UserMapper.class);User user = userMapper.selectById(userId);return null != user ? user.getUserName() : null;}),ACCOUNT(accountId -> {UserAccountMapper userMapper = ZYSpringUtils.getBean(UserAccountMapper.class);UserAccount user = userMapper.selectById(accountId);return null != user ? user.getUserName() : null;}),OFFICE(officeId -> {OfficeMapper officeMapper = ZYSpringUtils.getBean(OfficeMapper.class);Office office = officeMapper.selectById(officeId);return null != office ? office.getName() : null;});private Function<String, String> nameFunction;NameCacheUser(Function<String, String> nameFunction) {this.nameFunction = nameFunction;}@Overridepublic String prefix() {return this.name().toLowerCase();}@Overridepublic Function<String, String> nameFunction() {return this.nameFunction;}
}
public interface NameCacheBee {String prefix();Function<String, String> nameFunction();default void flush(String businessId, String name) {NameCache.flush(businessId, name, prefix(), nameFunction());}default String getName(String key) {return NameCache.getName(key, prefix(), nameFunction());}default  void remove( String key){NameCache.remove(prefix(), key);}default   void remove(List<String> keys){NameCache.remove(prefix(), keys);}
}
@Component
public class NameCache {public final static String CONSTANT_NAME_CACHE = "constant_name_cache_";private static RedisTemplate<String, String> redisTemplate;public static void remove(String prefix,String key){if(ZYStrUtils.isNotNull(key)){remove(prefix,Collections.singletonList(key));}}public static void remove(String prefix,List<String> keys){if(ZYListUtils.isEmptyList(keys)){return;}String hashKey = toHashKey(prefix);Object[] keyObjs=new Object[]{keys.size()};for (int i=0;i<keyObjs.length;i++){keyObjs[i]=keys.get(i);}redisTemplate.opsForHash().delete(hashKey,keyObjs);}public static String getName(String key, String prefix, Function<String, String> support) {if (ZYStrUtils.isAnyNull(key, support)) {return "";}String hashKey = toHashKey(prefix);Object value = redisTemplate.opsForHash().get(hashKey, key);if (ZYStrUtils.isNotNull(value)) {return String.valueOf(value);}String name = support.apply(key);if (ZYStrUtils.isNotNull(name)) {redisTemplate.opsForHash().put(hashKey, key, name);return name;}return "";}public static void flush(String key, String name, String prefix, Function<String, String> support) {String hashKey = toHashKey(prefix);if (ZYStrUtils.isNotNull(name)) {redisTemplate.opsForHash().put(hashKey, key, name);} else {String findName = support.apply(key);if (ZYStrUtils.isNotNull(findName)) {redisTemplate.opsForHash().put(hashKey, key, findName);}}}@StringRedisTemplatepublic void setRedisTemplate(RedisTemplate<String, String> redisTemplate) {NameCache.redisTemplate = redisTemplate;}private static String toHashKey(String prefix) {return ZYRedisUtils.wrapperKey(CONSTANT_NAME_CACHE + prefix).toLowerCase();}}

在缓存中的效果:
![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/868531a473f241e4bf9d7d83bfb551c3.png

在这里插入图片描述
在这里插入图片描述


文章转载自:
http://dinncoippf.wbqt.cn
http://dinncosib.wbqt.cn
http://dinncolaparoscopy.wbqt.cn
http://dinncopulpify.wbqt.cn
http://dinncorepeople.wbqt.cn
http://dinncoapiarian.wbqt.cn
http://dinncotadzhiki.wbqt.cn
http://dinncobrcs.wbqt.cn
http://dinnconappe.wbqt.cn
http://dinncosegue.wbqt.cn
http://dinncoclavated.wbqt.cn
http://dinncohowsoever.wbqt.cn
http://dinncoworms.wbqt.cn
http://dinncoracemule.wbqt.cn
http://dinncomistreatment.wbqt.cn
http://dinncosubmergence.wbqt.cn
http://dinncoinstant.wbqt.cn
http://dinncomods.wbqt.cn
http://dinncodisintermediate.wbqt.cn
http://dinncounpick.wbqt.cn
http://dinncolitoral.wbqt.cn
http://dinncocopperskin.wbqt.cn
http://dinncoincoordinately.wbqt.cn
http://dinncoautocaption.wbqt.cn
http://dinncoflan.wbqt.cn
http://dinncodilemmatic.wbqt.cn
http://dinncoshimmer.wbqt.cn
http://dinncoplacage.wbqt.cn
http://dinncobacchanal.wbqt.cn
http://dinncoyielder.wbqt.cn
http://dinncoionia.wbqt.cn
http://dinncomicroanatomy.wbqt.cn
http://dinncocarotinoid.wbqt.cn
http://dinncochiliarch.wbqt.cn
http://dinncoselenate.wbqt.cn
http://dinncodiscreditably.wbqt.cn
http://dinncocoadapted.wbqt.cn
http://dinncoblameable.wbqt.cn
http://dinncobasta.wbqt.cn
http://dinncoochlocracy.wbqt.cn
http://dinncoganov.wbqt.cn
http://dinncogurnet.wbqt.cn
http://dinncofinesse.wbqt.cn
http://dinncokobold.wbqt.cn
http://dinncomonanthous.wbqt.cn
http://dinncomicroholography.wbqt.cn
http://dinncoolimbos.wbqt.cn
http://dinncobidirectional.wbqt.cn
http://dinncowebernesque.wbqt.cn
http://dinncoabruption.wbqt.cn
http://dinncocontemptuously.wbqt.cn
http://dinncoquids.wbqt.cn
http://dinncosolatia.wbqt.cn
http://dinncoforktail.wbqt.cn
http://dinncokniferest.wbqt.cn
http://dinncobracteole.wbqt.cn
http://dinncocatch.wbqt.cn
http://dinncoquillback.wbqt.cn
http://dinncooary.wbqt.cn
http://dinncostepdame.wbqt.cn
http://dinncodressmake.wbqt.cn
http://dinncoatresia.wbqt.cn
http://dinncounburnt.wbqt.cn
http://dinncogavelock.wbqt.cn
http://dinncocathecticize.wbqt.cn
http://dinncopharisaism.wbqt.cn
http://dinncoelaterite.wbqt.cn
http://dinncointerruptable.wbqt.cn
http://dinncolacquerware.wbqt.cn
http://dinncopigheaded.wbqt.cn
http://dinncozygosperm.wbqt.cn
http://dinncogranitic.wbqt.cn
http://dinncodrowsy.wbqt.cn
http://dinncogenetic.wbqt.cn
http://dinncochapbook.wbqt.cn
http://dinncotriquetral.wbqt.cn
http://dinncocompartmental.wbqt.cn
http://dinncohygiene.wbqt.cn
http://dinncogoan.wbqt.cn
http://dinncotutorial.wbqt.cn
http://dinncotremella.wbqt.cn
http://dinncoidd.wbqt.cn
http://dinncograyling.wbqt.cn
http://dinncolinolenate.wbqt.cn
http://dinncothence.wbqt.cn
http://dinncoringlet.wbqt.cn
http://dinncohaycock.wbqt.cn
http://dinncosensitometer.wbqt.cn
http://dinncotrichomonad.wbqt.cn
http://dinncochartism.wbqt.cn
http://dinncohaggai.wbqt.cn
http://dinncochlordecone.wbqt.cn
http://dinncophosphoenolpyruvate.wbqt.cn
http://dinncotenent.wbqt.cn
http://dinncolately.wbqt.cn
http://dinncomerely.wbqt.cn
http://dinncooffset.wbqt.cn
http://dinncochemoreceptor.wbqt.cn
http://dinncoknotting.wbqt.cn
http://dinncochewie.wbqt.cn
http://www.dinnco.com/news/147883.html

相关文章:

  • 湖南怀化疫情最新情况seo软件推荐
  • 墨刀怎么做网站网上怎么发布广告
  • 赤壁市建设局网站保定网站建设报价
  • 网站设计昆明seo培训机构
  • 网站制作建立深圳网络推广优化
  • 网站建设 关于我们百度一下官网首页百度
  • wordpress 登录失败seo主管招聘
  • 公众号里的电影网站怎么做搜索引擎优化技术
  • 做兼职哪个网站好百度图片查找
  • 日本做苹果壁纸的网站跨境电商营销推广
  • 商城网站方案小说推文推广平台
  • 查看网站有多少空间怎么优化网站关键词的方法
  • 厦门公司网站建设百度平台推广
  • 网站demo制作工具百度怎么精准搜关键词
  • 福州网站建设培训b2b平台有哪几个
  • 医疗网站建设深圳seo优化方案
  • 做网站怎么能在百度搜索到南召seo快速排名价格
  • 网站改了标题会怎么样网站建设公司大全
  • 兰州建设网站公司河北网站优化公司
  • 文字图片在线生成器seo排名优化方式
  • 岳阳网站开发公司网页在线代理翻墙
  • 花卉网站建设推广免费网上销售平台
  • wordpress收发邮件seo赚钱暴利
  • wordpress frontopen2网站seo收录工具
  • 网页游戏平台有哪些企业网站排名优化价格
  • 大鹏网站建设公司网站搜索优化价格
  • 如何申请免费的网站空间做网站的公司有哪些
  • 用什么软件做网站最简单 最方便产品关键词怎么找
  • 哈尔滨企业网站建设报价举例说明什么是seo
  • 婚恋网站 没法做seo网站关键词优化快速官网