Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

jan-tennert/RedisKM

Repository files navigation

RedisKM

A Kotlin Multiplatform Redis Client.
Also supports RedisJSON with built-in KotlinX Serialization support.

Version: Maven Central

Available for:

JVM

  • android (not tested)
  • jvm

JS

  • browser
  • nodejs

Native

  • mingwx64
  • linuxX64
  • macosX64
  • macosArm64
  • iosX64

secure connections are only supported on mingx64, JVM and JS Now available for macos and linux

Introduction

You can build a new connection very easily with RedisClient:

val client = RedisClient.create(host = "URL", port = port, password = "password", user = "user")
client.connect()

//then set a value and get it back
client.put("login", "redis", expirationDuration = 10.hours)
val login = client.get<String>("login")

//for more options on a specific element:
val login = client.get<RedisElement>("login")
//to call things like
login.persist()
login.expire(10.hours)
login.rename("newLogin")

More information about Lists, Sets, the JSON module and more can be found in the Wiki.

Installation

dependencies {
    implementation("io.github.jan-tennert.rediskm:RedisKM:VERSION")
}

If you want a specific target you can change the artifact id to RedisKM-[target]