| | |
| | | import com.zy.core.model.command.StationCommand; |
| | | import com.zy.core.enums.RedisKeyType; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | import java.util.Objects; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | public class StationTaskTraceRegistry { |
| | | |
| | |
| | | if (loadedFromRedis) { |
| | | return; |
| | | } |
| | | long redisStartNs = System.nanoTime(); |
| | | Map<Object, Object> cacheMap = redisUtil == null ? null : redisUtil.hmget(TRACE_CACHE_KEY); |
| | | long redisCostMs = (System.nanoTime() - redisStartNs) / 1_000_000L; |
| | | if (redisCostMs > 100) { |
| | | log.info("StationTaskTraceRegistry Redis加载耗时={}ms, entries={}", redisCostMs, |
| | | cacheMap == null ? 0 : cacheMap.size()); |
| | | } |
| | | if (cacheMap != null && !cacheMap.isEmpty()) { |
| | | long now = System.currentTimeMillis(); |
| | | for (Map.Entry<Object, Object> entry : cacheMap.entrySet()) { |