当前位置: 首页 > 软件库 > 数据库相关 > >

lettuce-core

授权协议 Apache-2.0 License
开发语言 Java
所属分类 数据库相关
软件类型 开源软件
地区 不详
投 递 者 华泳
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Lettuce - Advanced Java Redis client

Lettuce is a scalable thread-safe Redis client for synchronous,asynchronous and reactive usage. Multiple threads may share one connection if they avoid blocking and transactionaloperations such as BLPOP and MULTI/EXEC.Lettuce is built with netty.Supports advanced Redis features such as Sentinel, Cluster, Pipelining, Auto-Reconnect and Redis data models.

This version of Lettuce has been tested against the latest Redis source-build.

See the reference documentation and Wiki for more details.

Communication

Documentation

Binaries/Download

Binaries and dependency information for Maven, Ivy, Gradle and others can be found at http://search.maven.org.

Releases of lettuce are available in the Maven Central repository. Take also a look at the Releases.

Example for Maven:

<dependency>
  <groupId>io.lettuce</groupId>
  <artifactId>lettuce-core</artifactId>
  <version>x.y.z</version>
</dependency>

If you'd rather like the latest snapshots of the upcoming major version, use our Maven snapshot repository and declare the appropriate dependency version.

<dependency>
  <groupId>io.lettuce</groupId>
  <artifactId>lettuce-core</artifactId>
  <version>x.y.z.BUILD-SNAPSHOT</version>
</dependency>

<repositories>
  <repository>
    <id>sonatype-snapshots</id>
    <name>Sonatype Snapshot Repository</name>
    <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
  </repository>
</repositories>

Basic Usage

RedisClient client = RedisClient.create("redis://localhost");
StatefulRedisConnection<String, String> connection = client.connect();
RedisStringCommands sync = connection.sync();
String value = sync.get("key");

Each Redis command is implemented by one or more methods with names identicalto the lowercase Redis command name. Complex commands with multiple modifiersthat change the result type include the CamelCased modifier as part of thecommand name, e.g. zrangebyscore and zrangebyscoreWithScores.

See Basic usage for further details.

Asynchronous API

StatefulRedisConnection<String, String> connection = client.connect();
RedisStringAsyncCommands<String, String> async = connection.async();
RedisFuture<String> set = async.set("key", "value")
RedisFuture<String> get = async.get("key")

async.awaitAll(set, get) == true

set.get() == "OK"
get.get() == "value"

See Asynchronous API for further details.

Reactive API

StatefulRedisConnection<String, String> connection = client.connect();
RedisStringReactiveCommands<String, String> reactive = connection.reactive();
Mono<String> set = reactive.set("key", "value");
Mono<String> get = reactive.get("key");

set.subscribe();

get.block() == "value"

See Reactive API for further details.

Pub/Sub

RedisPubSubCommands<String, String> connection = client.connectPubSub().sync();
connection.getStatefulConnection().addListener(new RedisPubSubListener<String, String>() { ... })
connection.subscribe("channel")

Cloud Provider Compatibility

While we're not actively testing Lettuce against various cloud offerings, we've verified initial compatibility with the following services (or have seen folks using Lettuce there):

  • AWS Elasticache (Operated in replica- and Redis Cluster mode)
  • Azure Redis
  • IBM Cloud Databases for Redis
  • Google Cloud Memorystore for Redis
  • RedisLabs Enterprise Redis Cluster

Note: Some providers operate Redis in non-standard modes that aren't fully supported by Lettuce.

Building

Lettuce is built with Apache Maven. The tests require multiple running Redis instances for different test cases whichare configured using a Makefile. Tests run by default against Redis unstable.

To build:

$ git clone https://github.com/lettuce-io/lettuce-core.git
$ cd lettuce/
$ make prepare ssl-keys
$ make test
  • Initial environment setup (clone and build redis): make prepare
  • Setup SSL Keys: make ssl-keys
  • Run the build: make test
  • Start Redis (manually): make start
  • Stop Redis (manually): make stop

Bugs and Feedback

For bugs, questions and discussions please use the GitHub Issues.

License

Contributing

Github is for social coding: if you want to write code, I encourage contributions through pull requests from forks of this repository.Create Github tickets for bugs and new features and comment on the ones that you are interested in and take a look into CONTRIBUTING.md

  • import java.text.MessageFormat; import java.util.ArrayList; import java.util.Map; import io.lettuce.core.RedisURI; import io.lettuce.core.cluster.ClusterClientOptions; import io.lettuce.core.cluster.

  • skywalking-plugin.def skywalking-6.6.0/apm-sniffer/optional-plugins/lettuce-5.x-plugin/src/main/resources/skywalking-plugin.def lettuce-5.x=org.apache.skywalking.apm.plugin.lettuce.v5.define.AbstractR

  • 本文章基于Redis 6.0.9版本,Lettuce 6.0.1.RELEASE版本 目录 1.入门 1.1.获取依赖包 2.开始编码 3.使用单独的Redis 4.带SSL的单独的Redis 5.Redis Sentinel 6.Redis Cluster 7.连接到ElastiCache主节点 8.使用主节点/复制节点连接到ElastiCache 9.连接到Azure Redis群集 10.与

  • redis lettuce 经过13个月的开发阶段和208张已解决的故障单,我很高兴宣布Lettuce 5.0全面上市。 这是一个主要发行版,带有一些重大更改,新的有趣功能以及Java 9兼容性。 从Maven Central获取发行版 <dependency> <groupId>io.lettuce</groupId> <artifactId>lettuce-core</arti

  • 参考: Springboot整合lettuce密码错误io.lettuce.core.RedisCommandExecutionException: NOAUTH Authentication require_hanyi_的专栏-程序员秘密 - 程序员秘密 (cxymm.net) 开发环境: springboot 2.4.5 spring-boot-starter-data-redis 2.4.5

  • 采用lettuce作为客户端连接redis的pom配置文件: <!-- spring-redis --> <!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-redis --> <dependency> <groupId>org.springframework.data</groupId> <ar

  • 主要是加了链路追踪 spring-cloud-sleuth-core 依赖追踪到redis出现的一些故障问题。 解决方案一: 直接把 spring-cloud-sleuth-core 依赖去掉即可 解决方案二: 修改redis的依赖方案: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spr

  • 一、可能最大连接数/超时时间设置过小 如图,检查最大连接数和超时时间,将其调大。 redis: lettuce: pool: MaxTotal: 50 #最大连接数 minIdle: 1 maxWaitMillis: 5000 maxIdle: 5 testOnBorrow: true

  • spring-boot-starter-data-redis有两种实现:lettuce 和 jedis 。然而默认是使用lettuce. spring boot 2的spring-boot-starter-data-redis中,默认使用的是lettuce作为redis客户端,它与jedis的主要区别如下: 1.Jedis: Jedis是同步的,不支持异步,Jedis客户端实例不是线程安全的,需要

  • 错误如下: 2021-11-30 19:48:30.002 [taskScheduler-2] ERROR com.test.daq.utils.RedisUtils - org.springframework.data.redis.RedisSystemException: Redis exception; nested exception is io.lettuce.core.RedisExc

  • springboot2之前redis的连接池为jedis,2.0以后redis的连接池改为了lettuce,lettuce能够支持redis4,需要java8及以上。lettuce是基于netty实现的与redis进行同步和异步的通信,下面为lettuce与redis进行简单的同步与异步的通信的示例,版本为5.0.4 public static void main(String[] args) t

 相关资料
  • Lettuce是一个可伸缩线程安全的Redis客户端。多个线程可以共享同一个RedisConnection。它利用优秀netty NIO框架来高效地管理多个连接。 示例代码: RedisClient client = new RedisClient("localhost")RedisConnection<String, String> connection = client.connect()St

  • Lettuce是一个非常有用的和迷人的BDD(行为驱动开发)工具。Python项目的自动化测试,它可以执行纯文本的功能描述,就像ruby语言的cucumber。 Lettuce,使开发和测试过程变得很容易,有较好的可扩展性、可读性,它允许我们用自然语言去描述个一个系统的行为,你不能想象这些描述可以自动测试你的系统。 依赖 您将需要安装这些依赖关系,以破解lettuce ,所有这些都使用在lettu

  • 我需要使用Azure Redis集群,有密码,有SSL,有流水线支持。 我尝试了lettuce(https://github.com/mp911de/lettuce/releases/tag/4.1.2.final),但目前遇到了一个无法单独解决的连接问题。 连接到一个Azure Redis集群(2*P4)不使用SSL但不使用SSL。另外,我可以使用SSL连接到单个节点,但不支持集群。问题是,当组

  • 本文向大家介绍SpringBoot整合Lettuce redis过程解析,包括了SpringBoot整合Lettuce redis过程解析的使用技巧和注意事项,需要的朋友参考一下 首先解释一下Lettuce客户端: Lettuce 和 Jedis 的都是连接Redis Server的客户端程序。Jedis在实现上是直连redis server,多线程环境下非线程安全,除非使用连接池,为每个Jedi

  • 我的Java客户机是: 当我尝试运行它时,我得到错误: 我做错了什么?提前谢了。