去除RMapCache对象获取时的CodeC设置

This commit is contained in:
everywhere.z 2023-11-13 18:17:53 +08:00
parent cb25e5a86b
commit bae0433551
2 changed files with 5 additions and 5 deletions

View File

@ -37,7 +37,7 @@ public class RClient {
* @return hashmap
*/
public Map<String, String> getMap(String key) {
RMapCache<String, String> mapCache = redissonClient.getMapCache(key, StringCodec.INSTANCE);
RMapCache<String, String> mapCache = redissonClient.getMapCache(key);
Set<String> mapFieldSet = mapCache.keySet();
if (CollectionUtil.isEmpty(mapFieldSet)) {
return map;

View File

@ -61,8 +61,8 @@ public class RedisWithXmlELSubscribeSpringbootTest extends BaseTest {
Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379").setDatabase(1);
redissonClient = Redisson.create(config);
RMapCache<String, String> chainKey = redissonClient.getMapCache("testChainKey", StringCodec.INSTANCE);
RMapCache<String, String> scriptKey = redissonClient.getMapCache("testScriptKey", StringCodec.INSTANCE);
RMapCache<String, String> chainKey = redissonClient.getMapCache("testChainKey");
RMapCache<String, String> scriptKey = redissonClient.getMapCache("testScriptKey");
scriptKey.put("s1:script:脚本s1:groovy", "defaultContext.setData(\"test1\",\"hello s1\");");
scriptKey.put("s2:script:脚本s2:js", "defaultContext.setData(\"test2\",\"hello s2\");");
scriptKey.put("s3:script:脚本s3", "defaultContext.setData(\"test3\",\"hello s3\");");
@ -184,8 +184,8 @@ public class RedisWithXmlELSubscribeSpringbootTest extends BaseTest {
//redis内规则数据数据清空
public static void testCleanData() {
if (ObjectUtil.isNotNull(redissonClient)) {
RMapCache<String, String> chainKey = redissonClient.getMapCache("testChainKey", StringCodec.INSTANCE);
RMapCache<String, String> scriptKey = redissonClient.getMapCache("testScriptKey", StringCodec.INSTANCE);
RMapCache<String, String> chainKey = redissonClient.getMapCache("testChainKey");
RMapCache<String, String> scriptKey = redissonClient.getMapCache("testScriptKey");
for (String key : chainKey.keySet()) {
chainKey.remove(key);
}