| | |
| | | @Slf4j |
| | | public class RealTimeEnergyConsumptionServiceImpl implements RealTimeEnergyConsumptionService { |
| | | |
| | | private static final long REMOTE_CACHE_TTL_SECONDS = 10L; |
| | | private static final long REMOTE_CACHE_TTL_SECONDS = 10L; // 缓存TTL,10秒 |
| | | |
| | | private static final long REMOTE_CACHE_TTL_SECONDS_30 = 30L; // 缓存TTL,30秒 |
| | | |
| | | private static final String URL = "https://new.e-elitech.cn/api/data-api"; |
| | | |
| | |
| | | if (result == null || result.trim().isEmpty()) { |
| | | return; |
| | | } |
| | | redisTemplate.opsForValue().set(cacheKey, result, REMOTE_CACHE_TTL_SECONDS, TimeUnit.SECONDS); |
| | | redisTemplate.opsForValue().set(cacheKey, result, REMOTE_CACHE_TTL_SECONDS_30, TimeUnit.SECONDS); |
| | | } |
| | | } |