Example usage for org.springframework.data.redis.connection.lettuce LettuceClusterTopologyProvider LettuceClusterTopologyProvider

List of usage examples for org.springframework.data.redis.connection.lettuce LettuceClusterTopologyProvider LettuceClusterTopologyProvider

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection.lettuce LettuceClusterTopologyProvider LettuceClusterTopologyProvider.

Prototype

LettuceClusterTopologyProvider(RedisClusterClient client) 

Source Link

Usage

From source file:org.springframework.data.redis.connection.lettuce.LettuceClusterConnection.java

/**
 * Creates new {@link LettuceClusterConnection} using {@link LettuceConnectionProvider} running commands across the
 * cluster via given {@link ClusterCommandExecutor}.
 *
 * @param connectionProvider must not be {@literal null}.
 * @since 2.0//www  . j  av  a 2 s . co  m
 */
public LettuceClusterConnection(LettuceConnectionProvider connectionProvider) {

    super(null, connectionProvider, RedisURI.DEFAULT_TIMEOUT_DURATION.toMillis(), 0);

    Assert.isTrue(connectionProvider instanceof ClusterConnectionProvider,
            "LettuceConnectionProvider must be a ClusterConnectionProvider.");

    this.clusterClient = getClient();
    this.topologyProvider = new LettuceClusterTopologyProvider(this.clusterClient);
    this.clusterCommandExecutor = new ClusterCommandExecutor(this.topologyProvider,
            new LettuceClusterNodeResourceProvider(getConnectionProvider()), exceptionConverter);
    this.disposeClusterCommandExecutorOnClose = true;
}

From source file:org.springframework.data.redis.connection.lettuce.LettuceClusterConnection.java

/**
 * Creates new {@link LettuceClusterConnection} using {@link LettuceConnectionProvider} running commands across the
 * cluster via given {@link ClusterCommandExecutor}.
 *
 * @param connectionProvider must not be {@literal null}.
 * @param executor must not be {@literal null}.
 * @param timeout must not be {@literal null}.
 * @since 2.0//from  w  w w.ja  va  2s . c  om
 */
public LettuceClusterConnection(LettuceConnectionProvider connectionProvider, ClusterCommandExecutor executor,
        Duration timeout) {

    super(null, connectionProvider, timeout.toMillis(), 0);

    Assert.notNull(executor, "ClusterCommandExecutor must not be null.");
    Assert.isTrue(connectionProvider instanceof ClusterConnectionProvider,
            "LettuceConnectionProvider must be a ClusterConnectionProvider.");

    this.clusterClient = getClient();
    this.topologyProvider = new LettuceClusterTopologyProvider(this.clusterClient);
    this.clusterCommandExecutor = executor;
    this.disposeClusterCommandExecutorOnClose = false;
}

From source file:org.springframework.data.redis.connection.lettuce.LettuceClusterConnection.java

/**
 * Creates new {@link LettuceClusterConnection} given a shared {@link StatefulRedisClusterConnection} and
 * {@link LettuceConnectionProvider} running commands across the cluster via given {@link ClusterCommandExecutor}.
 *
 * @param sharedConnection may be {@literal null} if no shared connection used.
 * @param connectionProvider must not be {@literal null}.
 * @param clusterClient must not be {@literal null}.
 * @param executor must not be {@literal null}.
 * @param timeout must not be {@literal null}.
 * @since 2.1/*from  ww  w.  j  a v  a  2s.c o m*/
 */
LettuceClusterConnection(@Nullable StatefulRedisClusterConnection<byte[], byte[]> sharedConnection,
        LettuceConnectionProvider connectionProvider, RedisClusterClient clusterClient,
        ClusterCommandExecutor executor, Duration timeout) {

    super(sharedConnection, connectionProvider, timeout.toMillis(), 0);

    Assert.notNull(executor, "ClusterCommandExecutor must not be null.");
    Assert.notNull(clusterClient, "RedisClusterClient must not be null.");

    this.clusterClient = clusterClient;
    this.topologyProvider = new LettuceClusterTopologyProvider(clusterClient);
    this.clusterCommandExecutor = executor;
    this.disposeClusterCommandExecutorOnClose = false;
}