DefaultFeatureCache.java 文件源码

java
阅读 45 收藏 0 点赞 0 评论 0

项目:outland 作者:
@Override public Optional<Feature> findInCache(String cacheKey) {
  //noinspection unchecked
  Optional<String> maybe = (Optional<String>) new RedisCacheCommand<Optional<String>>("CacheGet",
      () -> redisCache.get(cacheKey),
      Optional::empty,
      hystrixConfiguration,
      metrics).execute();

  if (maybe.isPresent()) {
    Feature cached = FeatureSupport.toFeature(maybe.get());
    logger.info("{} /feature=[{}]",
        kvp("op", "findInCache", "key", cacheKey, "result", "cache_hit"),
        TextFormat.shortDebugString(cached));
    return Optional.of(cached);
  }

  logger.info("{}", kvp("op", "findInCache", "key", cacheKey, "result", "cache_miss"));

  return Optional.empty();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号