RedisLib is a library for Redis which, even though it is light and simple to use, proves itself to be powerful and efficient. It was created to facilitate the development of applications that use Redis
import br.com.rabbithole.RedisLibTest;
import br.com.rabbithole.configurations.RedisConfig;
import br.com.rabbithole.core.builder.Query;
import br.com.rabbithole.core.builder.commands.string.Get;
import br.com.rabbithole.core.builder.commands.string.Sets;
import java.util.Optional;
public class Main {
public static void main(String[] args) {
//Starts a connection with Redis, passing the connection parameters
//RedisConfig(prefix, debug, ip, port, user, password, number Of Connections)
RedisLib.init(new RedisConfig("prefix", false, "localhost", 6379, "user", "password", 100));
//A simple Get Query
Query<Get> getQuery = new Get.Builder()
.setKey("Foo")
.build();
//A Get Query execution after construction
Optional<String> resultOfGetQuery = getQuery.getCommand().execute();
//A Get Query with execution in the construction
Optional<String> getQueryWithExecute = new Get.Builder()
.setKey("Foo")
.execute();
//A simple Set Query
Query<Sets> setQuery = new Sets.Builder()
.setKey("Foo")
.setValue("Bar")
.build();
//A Set Query execution after construction
Optional<Boolean> resultOfSetQuery = setQuery.getCommand().execute();
//A Set Query with execution in the construction
Optional<Boolean> setQueryWithExecute = new Sets.Builder()
.setKey("Foo")
.setValue("Bar")
.build();
}
}
"Work in progress"
- Add the repo to your project
Maven:
<repository>
<id>rabbithole-repo-snapshots</id>
<name>Rabbit Hole</name>
<url>https://repo.rabbithole.com.br/snapshots</url>
</repository>
Gradle (Groovy):
maven {
url "https://repo.rabbithole.com.br/snapshots"
}
Gradle (Kotlin):
maven {
url = uri("https://repo.rabbithole.com.br/snapshots")
}
- Add the dependency
Maven:
<dependency>
<groupId>br.com.rabbithole</groupId>
<artifactId>RedisLib</artifactId>
<version>2.5.0-SNAPSHOT</version>
</dependency>
Gradle (Groovy):
implementation "br.com.rabbithole:RedisLib:2.5.0-SNAPSHOT"
Gradle (Kotlin):
implementation("br.com.rabbithole:RedisLib:2.5.0-SNAPSHOT")
Felipe Ros Segundo Simão OS 2023 - RedisLib
2.5.0