Authored by mali

缓存细化

... ... @@ -230,6 +230,8 @@ public class RedisGwCacheClient implements CacheClient {
public <K, T> Map<K, T> getBulk(List<RedisKeyBuilder> redisKeyBuilders, Class<T> clazz, Function<List<K>, Map<K, T>> nullCacheFun, Function<String, K> keyConvertFun,
long timeOut, String cacheKeyPre, Map<String, K> cacheKeyAndStringMap) {
LOGGER.info("method getBulk bengin!");
try {
List<String> multiGet = valueOperations.multiGet(redisKeyBuilders);
int size = multiGet.size();
... ... @@ -271,7 +273,7 @@ public class RedisGwCacheClient implements CacheClient {
if (apply.isEmpty()) {
return;
}
LOGGER.info("method setBulk bengin!");
Map<RedisKeyBuilder, String> map = new HashMap<>();
for (Map.Entry<K, T> item : apply.entrySet()) {
String redisValue;
... ...
... ... @@ -22,7 +22,7 @@ import java.util.stream.Collectors;
*/
@Service
public class ProductSalesService {
private static Logger logger = LoggerFactory.getLogger(ProductSalesService.class);
private final static Logger logger = LoggerFactory.getLogger(ProductSalesService.class);
@Autowired
private ProductSalesMapper productSalesMapper;
... ... @@ -43,6 +43,7 @@ public class ProductSalesService {
}
}, new Function<List<Integer>, Map<Integer, Integer>>() {
public Map<Integer, Integer> apply(List<Integer> nullCacheKeys) {
logger.info("productSalesMapper.selectAmountByProductIdList param is {}", nullCacheKeys);
List<ProductSales> salesList = productSalesMapper.selectAmountByProductIdList(nullCacheKeys);
Map<Integer, Integer> salesMap = salesList.stream()
.collect(Collectors.toMap(ProductSales::getProductId, ProductSales::getAmount));
... ...