<mark>此插件，主要社区贡献人（Sorghum）</mark>

```xml
<dependency>
    <groupId>org.noear</groupId>
    <artifactId>lettuce-solon-plugin</artifactId>
</dependency>
```

#### 1、描述

数据扩展插件，基于 lettuce 封装（[代码仓库](https://github.com/lettuce-io/lettuce-core)），为 Solon Data 提供了 redis 的操作能力扩展。<mark>（v2.4.2 之后支持）</mark>


//这个插件，主要是为构建客户端提供小便利。其实也可以不用适配，直接使用。

#### 2、配置示例

配置分格有两种：1，将配置内容独立为一个文件；2，将配置做为主配置的内容（注意 "|" 符号）。

```yaml
### 任意选一种
### 模式一
redis.ds2:
  # Redis模式 (standalone, cluster, sentinel)
  redis-mode: standalone
  redis-uri: redis://localhost:6379/0

#### 模式二
lettuce.rd2:
  # Redis模式 (standalone, cluster, sentinel)
  redis-mode: standalone
  config:
    host: localhost
    port: 6379
#    socket: xxxx
#    client-name: myClientName
#    database: 0
#    sentinel-masterId: 'mymaster'
#    username: 'myusername'
#    password: 'mypassword'
#    ssl: false
#    verify-mode: FULL
#    startTls: false
#    timeout: 10000
#    sentinels:
#      - host: localhost
#        port: 16379
#        password: 'mypassword'
#      - host: localhost
#        port: 26379
#        password: 'mypassword'
```

#### 3、应用示例

```java
@Configuration
public class Config {
    @Bean(value = "redisDs1", typed = true)
    public RedisClient demo1(@Inject("${redis.ds1}") LettuceSupplier supplier) {
        return (RedisClient)supplier.get();
    }

    @Bean("redisDs2")
    public RedisClient demo2(@Inject("${redis.ds2}") LettuceSupplier supplier) {
        return (RedisClient)supplier.get(); //集群类的用 RedisClusterClient
    }
    
    //或者直接用 AbstractRedisClient
}

@Component
public class DemoService {
    
    @Inject //@Inject("redisDs1")
    RedisClient demo1;

    @Inject("redisDs2")
    RedisClient demo2;
    
}
```




