Search in sources :

Example 1 with RedisCachedDatabase

use of net.kodehawa.mantarobot.db.redis.RedisCachedDatabase in project MantaroBot by Mantaro.

the class MantaroData method db.

public static ManagedDatabase db() {
    if (db == null) {
        Config.RedisInfo i = config().get().redis;
        if (i.enabled) {
            RedissonClient client = redisson();
            db = new RedisCachedDatabase(conn(), map(client, "custom-commands", i.customCommands), map(client, "guilds", i.guilds), map(client, "players", i.players), map(client, "users", i.users), map(client, "premium-keys", i.premiumKeys), client.getBucket("mantaro"));
        } else {
            db = new ManagedDatabase(conn());
        }
    }
    return db;
}
Also used : RedissonClient(org.redisson.api.RedissonClient) ManagedDatabase(net.kodehawa.mantarobot.db.ManagedDatabase) RedisCachedDatabase(net.kodehawa.mantarobot.db.redis.RedisCachedDatabase)

Aggregations

ManagedDatabase (net.kodehawa.mantarobot.db.ManagedDatabase)1 RedisCachedDatabase (net.kodehawa.mantarobot.db.redis.RedisCachedDatabase)1 RedissonClient (org.redisson.api.RedissonClient)1