forked from brianmaierjr/long-haul
-
Notifications
You must be signed in to change notification settings - Fork 2
Getting started
ebaas edited this page Jun 8, 2017
·
2 revisions
You can get started with lettuce in various ways.
Add these lines to file pom.xml:
<dependency>
<groupId>biz.paluch.redis</groupId>
<artifactId>lettuce</artifactId>
<version>4.3.1.Final</version>
</dependency>
Add these lines to file ivy.xml:
<ivy-module>
<dependencies>
<dependency org="biz.paluch.redis" name="lettuce" rev="4.3.1.Final"/>
</dependencies>
</ivy-module>
Add these lines to file build.gradle:
dependencies {
compile 'biz.paluch.redis:lettuce:4.3.1.Final'
}
Download the latest binary package from https://github.com/mp911de/lettuce/releases and extract the archive.
So easy! No more boring routines, we can start.
Import required classes:
import com.lambdaworks.redis.*;
and now, write your code:
RedisClient redisClient = RedisClient.create("redis://password@localhost:6379/0");
StatefulRedisConnection<String, String> connection = redisClient.connect();
RedisCommands<String, String> syncCommands = connection.sync();
syncCommands.set("key", "Hello, Redis!");
connection.close();
redisClient.shutdown();
Done!
Do you want to see working examples?
This wiki and the README document contains a lot of information, please take your time and read these instructions carefully.
If you run into any trouble, you may start with getting started.