package com.lambdaworks.redis.api; import com.lambdaworks.redis.api.async.RedisAsyncCommands; import com.lambdaworks.redis.api.rx.RedisReactiveCommands; import com.lambdaworks.redis.api.sync.RedisCommands; import com.lambdaworks.redis.protocol.ConnectionWatchdog; /** * A thread-safe connection to a redis server. Multiple threads may share one {@link StatefulRedisConnection}. * * A {@link ConnectionWatchdog} monitors each connection and reconnects automatically until {@link #close} is called. All * pending commands will be (re)sent after successful reconnection. * * @param <K> Key type. * @param <V> Value type. * @author Mark Paluch * @since 4.0 */ public interface StatefulRedisConnection<K, V> extends StatefulConnection<K, V> { /** * * @return true, if the connection is within a transaction. */ boolean isMulti(); /** * Returns the {@link RedisCommands} API for the current connection. Does not create a new connection. * * @return the synchronous API for the underlying connection. */ RedisCommands<K, V> sync(); /** * Returns the {@link RedisAsyncCommands} API for the current connection. Does not create a new connection. * * @return the asynchronous API for the underlying connection. */ RedisAsyncCommands<K, V> async(); /** * Returns the {@link RedisReactiveCommands} API for the current connection. Does not create a new connection. * * @return the reactive API for the underlying connection. */ RedisReactiveCommands<K, V> reactive(); }