Category : lettuce

Order This article mainly studies lettuce’s index monitoring DefaultCommandLatencyEventPublisher lettuce-core-5.0.4.RELEASE-sources.jar! /io/lettuce/core/event/metrics/DefaultCommandLatencyEventPublisher.java public class DefaultCommandLatencyEventPublisher implements MetricEventPublisher { private final EventExecutorGroup eventExecutorGroup; private final EventPublisherOptions options; private final EventBus eventBus; private final CommandLatencyCollector commandLatencyCollector; private final Runnable EMITTER = this::emitMetricsEvent; private volatile ScheduledFuture<?> scheduledFuture; public DefaultCommandLatencyEventPublisher(EventExecutorGroup eventExecutorGroup, EventPublisherOptions options, EventBus eventBus, CommandLatencyCollector commandLatencyCollector) { this.eventExecutorGroup = ..

Read more

Order This article mainly studies lettuce’s sentinel connection RedisClient.connectSentinel lettuce-core-5.0.4.RELEASE-sources.jar! /io/lettuce/core/RedisClient.java private <K, V> StatefulRedisSentinelConnection<K, V> connectSentinel(RedisCodec<K, V> codec, RedisURI redisURI, Duration timeout) { assertNotNull(codec); checkValidRedisURI(redisURI); ConnectionBuilder connectionBuilder = ConnectionBuilder.connectionBuilder(); connectionBuilder.clientOptions(ClientOptions.copyOf(getOptions())); connectionBuilder.clientResources(clientResources); DefaultEndpoint endpoint = new DefaultEndpoint(clientOptions); StatefulRedisSentinelConnectionImpl<K, V> connection = newStatefulRedisSentinelConnection(endpoint, codec, timeout); logger.debug(“Trying to get a Redis Sentinel connection for one of: ” ..

Read more

Order This article mainly studies the verification of spring-data-redis connection pool. lettuce LettucePoolingConnectionProvider spring-data-redis/2.0.10.RELEASE/spring-data-redis-2.0.10.RELEASE-sources.jar! /org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java class LettucePoolingConnectionProvider implements LettuceConnectionProvider, RedisClientProvider, DisposableBean { private static final Log log = LogFactory.getLog(LettucePoolingConnectionProvider.class); private final LettuceConnectionProvider connectionProvider; private final GenericObjectPoolConfig poolConfig; private final Map<StatefulConnection<?, ?>, GenericObjectPool<StatefulConnection<?, ?>>> poolRef = new ConcurrentHashMap(32); private final Map<Class<?>, GenericObjectPool<StatefulConnection<?, ?>>> pools = new ..

Read more

Order This article mainly studies the encapsulation of lettuce by redisTemplate. RedisTemplate spring-data-redis-2.0.10.RELEASE-sources.jar! /org/springframework/data/redis/core/RedisTemplate.java public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperations<K, V>, BeanClassLoaderAware { //…… /** * Executes the given action object within a connection that can be exposed or not. Additionally, the connection can * be pipelined. Note the results of the pipeline ..

Read more

Order This article mainly studies lettuce’s shareNativeConnection parameter. LettuceConnectionFactory spring-data-redis-2.0.10.RELEASE-sources.jar! /org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java public class LettuceConnectionFactory implements InitializingBean, DisposableBean, RedisConnectionFactory, ReactiveRedisConnectionFactory { private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION = new PassThroughExceptionTranslationStrategy( LettuceConverters.exceptionConverter()); private final Log log = LogFactory.getLog(getClass()); private final LettuceClientConfiguration clientConfiguration; private @Nullable AbstractRedisClient client; private @Nullable LettuceConnectionProvider connectionProvider; private @Nullable LettuceConnectionProvider reactiveConnectionProvider; private boolean validateConnection = ..

Read more

Order This article mainly studies Lettuce OolingConnectionProvider. LettucePoolingConnectionProvider spring-data-redis-2.0.10.RELEASE-sources.jar! /org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java /** * {@link LettuceConnectionProvider} with connection pooling support. This connection provider holds multiple pools (one * per connection type) for contextualized connection allocation. * <p /> * Each allocated connection is tracked and to be returned into the pool which created the connection. Instances of ..

Read more