redis tests - hashes
parent
46e03ec877
commit
e56d822bde
|
@ -116,6 +116,9 @@ public class PostLoginListener implements Listener {
|
|||
.set("player:" + proxiedPlayer.getUniqueId().toString(),
|
||||
packer.toByteArray());
|
||||
|
||||
ProxySystem.getInstance().getRedisManager().getRedisHashCommands()
|
||||
.hset("player", proxiedPlayer.getUniqueId().toString(), "online");
|
||||
|
||||
MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(packer.toByteArray());
|
||||
|
||||
String playerName = unpacker.unpackString();
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package net.krakatoa.proxy.redis;
|
||||
|
||||
import io.lettuce.core.Value;
|
||||
import io.lettuce.core.dynamic.Commands;
|
||||
import io.lettuce.core.dynamic.annotation.Key;
|
||||
import java.util.Map;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
public interface RedisHashCommands extends Commands {
|
||||
|
||||
Mono<Long> hdel(Key key, Key... fields);
|
||||
|
||||
Mono<Boolean> hset(Key key, Key field, Value value);
|
||||
|
||||
Boolean hset(String key, String field, String value);
|
||||
|
||||
Mono<String> hmset(Key key, Map<Key, Value> map);
|
||||
}
|
|
@ -15,12 +15,13 @@ public class RedisManager {
|
|||
//private RedisKeyReactiveCommands<String, String> keyReactiveCommands;
|
||||
|
||||
private RedisKeyCommands redisKeyCommands;
|
||||
private RedisHashCommands redisHashCommands;
|
||||
|
||||
public void connect() {
|
||||
this.client = RedisClient.create(this.getConnectionUri());
|
||||
RedisCommandFactory factory = new RedisCommandFactory(client.connect());
|
||||
this.redisKeyCommands = factory.getCommands(RedisKeyCommands.class);
|
||||
|
||||
this.redisHashCommands = factory.getCommands(RedisHashCommands.class);
|
||||
//this.connection = client.connect();
|
||||
//this.commands = connection.sync();
|
||||
//this.keyReactiveCommands = this.connection.reactive();
|
||||
|
|
Loading…
Reference in New Issue