[英]Serializer for Value which holds Set<String> in redis
I have to store Set as value in my redis. 我必须将Set作为值存储在Redis中。 I am not able to figure out how to serialize it and set in the below object
我无法弄清楚如何序列化它并在下面的对象中进行设置
RedisTemplate<String,Set<String>> redisTemplate = new RedisTemplate<String, Set<String>>();
redisTemplate.setHashValueSerializer(NEED_A_HASH_VALUE_SERIALIZER_HERE);
redisTemplate.setValueSerializer(NEED_A_VALUE_SERIALIZER_HERE);
Need some help here 在这里需要一些帮助
You can use lpush or rpush in redis to push your strings into an array in redis and retrive it using the following method. 您可以在redis中使用lpush或rpush将字符串推入redis中的数组,并使用以下方法对其进行检索。
List<String> result = cacheClient.getLRange("FRE_TRIG_WL", 0, -1);
HashSet<String> wl = new HashSet<String>(result);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.