/Kedis

Redis Kotlin wrapper based on Jedis

Primary LanguageKotlinApache License 2.0Apache-2.0

Kedis

Redis Kotlin wrapper based on Jedis

How to get it!

Maven

<dependency>
    <groupId>com.sxtanna.database</groupId>
    <artifactId>Kedis</artifactId>
    <version>LATEST</version>
</dependency>

Gradle

compile "com.sxtanna.database:Kedis:+"

How it works!

1-0. To create a new instance of Kedis, you would follow this syntax

From Kotlin

val kedis = Kedis[file: File]

From Java

final Kedis kedis = Kedis.get(file: File);

1-1. To initialize and shutdown a database use these two methods

kedis.enable()

and

kedis.disable()

2-0. After you have an instance, to get a resource

From Kotlin

val resource = kedis.resource()

From Java

final Jedis resource = kedis.resource();

Database#resource will throw an IllegalStateException if it's unable to create a resource a/o the database isn't enabled

2-1. Or you could utilize the Database's ability to automatically manage the connection with the invoke methods

From Kotlin

kedis {                       
	set("Username", "Sxtanna")
}                                                                     

From Java

kedis.execute(task -> task.set("Username", "Sxtanna"));