Redis客戶端之Lettuce


簡介:基於Netty框架的事件驅動的通信層,Redis 客戶端,線程安全同步。異步調用。

lettuce 官網地址:https://lettuce.io/

lettuce git項目地址:https://github.com/lettuce-io/lettuce-core

使用:
1、在pom.xml 中加入依賴

io.lettuce lettuce-core 5.1.7.RELEASE

2、 調用

import io.lettuce.core.*;

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();


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM