Skip to content

Getting started

Mark Paluch edited this page Jan 20, 2017 · 17 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>{version}</version>
</dependency>

For Ivy users:

Add these lines to file ivy.xml:

<ivy-module>
  <dependencies>
    <dependency org="biz.paluch.redis" name="lettuce" rev="{version}"/>
  </dependencies>
</ivy-module>

For Gradle users:

Add these lines to file build.gradle:

dependencies {
  compile 'biz.paluch.redis:lettuce:{version}'
}

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