redis tests - hashes

master
Alex 2022-03-26 20:34:54 +01:00
parent f3a3489551
commit 4197762722
2 changed files with 11 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import earth.krakatao.protocol.KraSocketClientProtocolMessage;
import earth.krakatao.protocol.KraSocketClientProtocolStatus;
import java.io.IOException;
import java.security.SecureRandom;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import net.krakatoa.proxy.ProxySystem;
@ -115,13 +116,16 @@ public class PostLoginListener implements Listener {
ProxySystem.getInstance().getRedisManager().getRedisKeyCommands()
.set("player:" + proxiedPlayer.getUniqueId().toString(),
packer.toByteArray());
/*
ProxySystem.getInstance().getRedisManager().getRedisHashCommands()
.hset("player", proxiedPlayer.getUniqueId().toString(), "online");
*/
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("skin", "steve");
hashMap.put("money", "101001");
hashMap.put("state", "online");
ProxySystem.getInstance().getRedisManager().getRedisHashCommands()
.hset("player", proxiedPlayer.getUniqueId().toString(),
"car", "bmw", "year", "2004");
.hset("player", proxiedPlayer.getUniqueId().toString(), hashMap);
MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(packer.toByteArray());

View File

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