Skip to content

Getting started (3.x)

Mark Paluch edited this page Apr 30, 2016 · 3 revisions

You can get started with lettuce in various ways.

1. Get it

For Maven users:

Add these lines to file pom.xml:

<dependency>
    <groupId>biz.paluch.redis</groupId>
    <artifactId>lettuce</artifactId>
    <version>3.4.3.Final</version>
</dependency>

For Ivy users:

Add these lines to file ivy.xml:

<ivy-module>
  <dependencies>
    <dependency org="biz.paluch.redis" name="lettuce" rev="3.4.3.Final"/>
  </dependencies>
</ivy-module>

For Gradle users:

Add these lines to file build.gradle:

dependencies {
  compile 'biz.paluch.redis:lettuce:3.4.3.Final'
}

Plain Java

Download the latest binary package from https://github.com/mp911de/lettuce/releases and extract the archive

2. Start coding

So easy! No more boring routines, we can start.

Import required classes:

import com.lambdaworks.redis.*;

and now, write your code:

RedisClient redisClient = new RedisClient(RedisURI.create("redis://password@localhost:6379/0"));
RedisConnection<String, String> connection = redisClient.connect();

connection.set("key", "Hello, Redis!");

connection.close();
redisClient.shutdown();

Done!

Do you want to see working examples?

Clone this wiki locally