ktor redis client feature base on lettuce(https://github.com/lettuce-io/lettuce-core)
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.ZenLiuCN:ktor_redis:v0.0.1'
}
//initialize
fun Application.main(){
install(RedisFactory){
// configruation for redis to connect
url="redis://[email protected]:6379/0?timeout=10s"
}
}
//use anywhere
fun someRedisOpts(){
val client=RedisFactory.newClient(Utf8StringCodec())
println(client.set("somekey","somevalue"))
println(client.get("somekey")
}
now only add url as configruation parameter