| | |
| | | if (StringUtils.isBlank(flag)) { |
| | | return null; |
| | | } |
| | | Config mem = CONFIG_CACHE.get(flag); |
| | | if (isEffectiveConfig(mem)) { |
| | | return mem; |
| | | } |
| | | if (mem != null) { |
| | | CONFIG_CACHE.remove(flag); |
| | | } |
| | | if (redisReady()) { |
| | | Config fromRedis = tryRedisGetConfig(flag); |
| | | if (isEffectiveConfig(fromRedis)) { |
| | |
| | | tryRedisSetexConfig(flag, loaded); |
| | | } |
| | | return loaded; |
| | | } |
| | | Config cached = CONFIG_CACHE.get(flag); |
| | | if (isEffectiveConfig(cached)) { |
| | | return cached; |
| | | } |
| | | if (cached != null) { |
| | | CONFIG_CACHE.remove(flag); |
| | | } |
| | | Config loaded = loadConfigFromDb(flag); |
| | | if (loaded != null) { |