https://github.com/kdatabases/kedis
Redis Kotlin wrapper based on Jedis
https://github.com/kdatabases/kedis
apache2 databases jedis kotlin maven redis wrapper
Last synced: 13 days ago
JSON representation
Redis Kotlin wrapper based on Jedis
- Host: GitHub
- URL: https://github.com/kdatabases/kedis
- Owner: KDatabases
- License: apache-2.0
- Created: 2017-03-30T21:57:47.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-09-28T19:43:00.000Z (over 7 years ago)
- Last Synced: 2023-07-26T22:46:15.726Z (over 2 years ago)
- Topics: apache2, databases, jedis, kotlin, maven, redis, wrapper
- Language: Kotlin
- Size: 12.7 KB
- Stars: 16
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kedis
Redis Kotlin wrapper based on Jedis
## How to get it!
### Maven
```xml
com.sxtanna.database
Kedis
LATEST
```
### Gradle
```groovy
compile "com.sxtanna.database:Kedis:+"
```
## How it works!
### 1-0. To create a new instance of [Kedis](src/main/kotlin/com/sxtanna/database/Kedis.kt), you would follow this syntax
#### From Kotlin
``` kotlin
val kedis = Kedis[file: File]
```
#### From Java
``` java
final Kedis kedis = Kedis.get(file: File);
```
### 1-1. To initialize and shutdown a database use these two methods
``` kotlin
kedis.enable()
```
and
``` kotlin
kedis.disable()
```
### 2-0. After you have an instance, to get a resource
#### From Kotlin
``` kotlin
val resource = kedis.resource()
```
#### From Java
``` java
final Jedis resource = kedis.resource();
```
*[Database#resource](https://github.com/KDatabases/Core/blob/master/src/main/kotlin/com.sxtanna/database/base/Database.kt#L96) 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
``` kotlin
kedis {
set("Username", "Sxtanna")
}
```
#### From Java
``` java
kedis.execute(task -> task.set("Username", "Sxtanna"));
```