redis tests - hashes

master
Alex 2022-03-26 20:46:35 +01:00
parent 4197762722
commit 2c9bbbf9a5
2 changed files with 8 additions and 7 deletions

View File

@ -9,6 +9,7 @@ import earth.krakatao.protocol.KraSocketClientProtocolStatus;
import java.io.IOException; import java.io.IOException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Consumer; import java.util.function.Consumer;
import net.krakatoa.proxy.ProxySystem; import net.krakatoa.proxy.ProxySystem;
@ -120,12 +121,12 @@ public class PostLoginListener implements Listener {
ProxySystem.getInstance().getRedisManager().getRedisHashCommands() ProxySystem.getInstance().getRedisManager().getRedisHashCommands()
.hset("player", proxiedPlayer.getUniqueId().toString(), "online"); .hset("player", proxiedPlayer.getUniqueId().toString(), "online");
*/ */
HashMap<String, String> hashMap = new HashMap<>(); Map<String, String> map = new HashMap<>();
hashMap.put("skin", "steve"); map.put("skin", "steve");
hashMap.put("money", "101001"); map.put("money", "101001");
hashMap.put("state", "online"); map.put("state", "online");
ProxySystem.getInstance().getRedisManager().getRedisHashCommands() ProxySystem.getInstance().getRedisManager().getRedisHashCommands()
.hset("player", proxiedPlayer.getUniqueId().toString(), hashMap); .hmset("player:" + proxiedPlayer.getUniqueId().toString(), map);
MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(packer.toByteArray()); MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(packer.toByteArray());

View File

@ -1,7 +1,7 @@
package net.krakatoa.proxy.redis; package net.krakatoa.proxy.redis;
import io.lettuce.core.dynamic.Commands; import io.lettuce.core.dynamic.Commands;
import java.util.HashMap; import java.util.Map;
public interface RedisHashCommands extends Commands { public interface RedisHashCommands extends Commands {
@ -13,7 +13,7 @@ public interface RedisHashCommands extends Commands {
Long hset(String key, String field, String... value); Long hset(String key, String field, String... value);
Long hset(String key, String field, HashMap<String, String> hashMap); String hmset(String key, Map<String, String> map);
//Mono<String> hmset(Key key, Map<Key, Value> map); //Mono<String> hmset(Key key, Map<Key, Value> map);
} }