...
|
...
|
@@ -16,6 +16,7 @@ import com.yohoufo.resource.util.RedisLoadingCache; |
|
|
import com.yohoufo.resource.util.ValueSerializer;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.InitializingBean;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
...
|
...
|
@@ -28,7 +29,7 @@ import java.util.concurrent.TimeUnit; |
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class ConfigTypeServiceImpl implements IConfigTypeService {
|
|
|
public class ConfigTypeServiceImpl implements IConfigTypeService, InitializingBean {
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigTypeServiceImpl.class);
|
|
|
|
|
|
private LocalCache localCache = new LocalCache();
|
...
|
...
|
@@ -44,7 +45,11 @@ public class ConfigTypeServiceImpl implements IConfigTypeService { |
|
|
@Redis("yohoNoSyncRedis")
|
|
|
private YHValueOperations valueOperations;
|
|
|
|
|
|
private final RedisLoadingCache<String, ConfigType> codeConfigTypeRedisCache = RedisCacheBuilder.newBuilder()
|
|
|
private RedisLoadingCache<String, ConfigType> codeConfigTypeRedisCache;
|
|
|
|
|
|
@Override
|
|
|
public void afterPropertiesSet() throws Exception {
|
|
|
codeConfigTypeRedisCache = RedisCacheBuilder.newBuilder()
|
|
|
.withYhRedis(redisTemplate, valueOperations)
|
|
|
.withExpire(5, TimeUnit.SECONDS)
|
|
|
.withKeySerializer(new KeySerializer<String>() {
|
...
|
...
|
@@ -79,6 +84,7 @@ public class ConfigTypeServiceImpl implements IConfigTypeService { |
|
|
}
|
|
|
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@PostConstruct
|
|
|
private void init() {
|
...
|
...
|
@@ -126,4 +132,5 @@ public class ConfigTypeServiceImpl implements IConfigTypeService { |
|
|
return rows;
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|