Skip to content

Getting started (4.x)

Mark Paluch edited this page Jun 13, 2020 · 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>4.4.4.Final</version>
</dependency>

For Ivy users:

Add these lines to file ivy.xml:

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

For Gradle users:

Add these lines to file build.gradle:

dependencies {
  compile 'biz.paluch.redis:lettuce:4.4.4.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 = 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?

Clone this wiki locally