2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2026-06-24 03:46:43 +00:00

Use more efficient HMSET when possible.

This commit is contained in:
Tux
2015-06-22 04:00:25 -04:00
parent b21c02eca0
commit 4834b7826f
3 changed files with 12 additions and 7 deletions
@@ -27,6 +27,7 @@
package com.imaginarycode.minecraft.redisbungee.util;
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.imaginarycode.minecraft.redisbungee.RedisBungee;
import lombok.Getter;
@@ -200,14 +201,14 @@ public final class UUIDTranslator {
public final void persistInfo(String name, UUID uuid, Jedis jedis) {
addToMaps(name, uuid);
jedis.hset("uuid-cache", name.toLowerCase(), RedisBungee.getGson().toJson(uuidToNameMap.get(uuid)));
jedis.hset("uuid-cache", uuid.toString(), RedisBungee.getGson().toJson(uuidToNameMap.get(uuid)));
String json = RedisBungee.getGson().toJson(uuidToNameMap.get(uuid));
jedis.hmset("uuid-cache", ImmutableMap.of(name, json, uuid.toString(), json));
}
public final void persistInfo(String name, UUID uuid, Pipeline jedis) {
addToMaps(name, uuid);
jedis.hset("uuid-cache", name.toLowerCase(), RedisBungee.getGson().toJson(uuidToNameMap.get(uuid)));
jedis.hset("uuid-cache", uuid.toString(), RedisBungee.getGson().toJson(uuidToNameMap.get(uuid)));
String json = RedisBungee.getGson().toJson(uuidToNameMap.get(uuid));
jedis.hmset("uuid-cache", ImmutableMap.of(name, json, uuid.toString(), json));
}
@RequiredArgsConstructor