初始化hash缓存-get
parent
2bc592c87e
commit
bee6f5678c
|
@ -49,7 +49,7 @@ public interface HashCache <K, HK, HV> extends DecorationKey<K> {
|
|||
* @param hashKeyList hash键集合
|
||||
* @return hash值
|
||||
*/
|
||||
public HV get(K key, HK... hashKeyList);
|
||||
public List<HV> get(K key, HK... hashKeyList);
|
||||
|
||||
/**
|
||||
* 获取hash值集合
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.muyu.common.cache.HashCache;
|
|||
import com.muyu.common.redis.service.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -76,8 +77,9 @@ public abstract class HashCacheAbs<K, HK, HV> implements HashCache<K, HK, HV> {
|
|||
* @return hash值
|
||||
*/
|
||||
@Override
|
||||
public HV get (K key, HK... hashKeyList) {
|
||||
return null;
|
||||
public List<HV> get (K key, HK... hashKeyList) {
|
||||
List<String> encodeHashKeyList = Arrays.stream(hashKeyList).map(this::encodeHashKey).toList();
|
||||
return redisService.getMultiCacheMapValue(encode(key), encodeHashKeyList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -229,7 +229,7 @@ public class RedisService {
|
|||
*
|
||||
* @return Hash对象集合
|
||||
*/
|
||||
public <T> List<T> getMultiCacheMapValue (final String key, final Collection<Object> hKeys) {
|
||||
public <T> List<T> getMultiCacheMapValue (final String key, final Collection<?> hKeys) {
|
||||
return redisTemplate.opsForHash().multiGet(key, hKeys);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue