All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.skillw.pouvoir.internal.feature.database.redis.Redis.kt Maven / Gradle / Ivy

There is a newer version: 1.6.7-beta-6
Show newest version
package com.skillw.pouvoir.internal.feature.database.redis

import com.skillw.pouvoir.api.feature.database.DatabaseType
import com.skillw.pouvoir.api.plugin.annotation.AutoRegister
import com.skillw.pouvoir.api.plugin.map.DataMap
import taboolib.expansion.SingleRedisConnector

@AutoRegister
internal object Redis : DatabaseType("redis") {
    override fun connect(params: DataMap): RedisContainerHolder {
        val host = params.get("host", "localhost")
        val port = params.get("port", 6379)
        val auth = params.get("auth", "root")
        val connect = params.get("connect", 32)
        val timeout = params.get("timeout", 1000)
        return SingleRedisConnector()
            .host(host)
            .port(port)
            .auth(auth)
            .connect(connect)
            .timeout(timeout)
            .connect()
            .connection()
            .let { RedisContainerHolder(it) }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy