final class RedisNodeClient extends RedisNodeExecutor with Closeable
Redis client implementation for a single Redis node using a connection pool. Connection pool size is constant and batches and operations are distributed over connections using round-robin scheme. Connections are automatically reconnected upon failure (possibly with an appropriate delay, see NodeConfig for details).
- Self Type
- RedisNodeClient
- Alphabetic
- By Inheritance
- RedisNodeClient
- Closeable
- AutoCloseable
- RedisNodeExecutor
- RedisOpExecutor
- RedisKeyedExecutor
- RedisExecutor
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new RedisNodeClient(address: NodeAddress = NodeAddress.Default, config: NodeConfig = NodeConfig(), clusterNode: Boolean = false)(implicit system: ActorSystem)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val address: NodeAddress
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
close(): Unit
- Definition Classes
- RedisNodeClient → Closeable → AutoCloseable
- val clusterNode: Boolean
- val config: NodeConfig
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
executeBatch[A](batch: RedisBatch[A], config: ExecutionConfig): commons.Future[A]
Executes a RedisBatch on this client by sending its commands to the Redis node in a single network message (technically, a single
akka.io.Tcp.Write
message).Executes a RedisBatch on this client by sending its commands to the Redis node in a single network message (technically, a single
akka.io.Tcp.Write
message). Therefore it's also naturally guaranteed that all commands in a batch are executed on the same connection.Note that even though connection used by RedisNodeClient are automatically reconnected, it's still possible that an error is returned for some batches that were executed around the time connection failure happened. To be precise, ConnectionClosedException is returned for batches that were sent through the connection but the connection failed before a response could be received. There is no way to safely retry such batches because it is unknown whether Redis node actually received and executed them or not.
Execution of each command in the batch or the whole batch may fail due to following reasons:
- ForbiddenCommandException when trying to execute command not supported by this client type
- ErrorReplyException when Redis server replies with an error for some command. In particular, if this client was obtained from RedisClusterClient then every keyed command may fail with cluster redirection. You can pattern-match redirection errors using RedirectionException extractor object.
- UnexpectedReplyException when Redis server replies with something unexpected by a decoder of some command
- ConnectionClosedException when connection is closed or reset (the client reconnects automatically after connection failure but commands that were in the middle of execution may still fail)
- WriteFailedException when a network write failed
- NodeRemovedException when this client was obtained from RedisClusterClient and Redis node that it's connected to is no longer a master
- Definition Classes
- RedisNodeClient → RedisExecutor
-
def
executeOp[A](op: RedisOp[A], executionConfig: ExecutionConfig): commons.Future[A]
Executes a RedisOp on this client.
Executes a RedisOp on this client. RedisOp is a sequence of dependent RedisBatches, that requires an exclusive access to a single Redis connection. Typically, a RedisOp is a
WATCH
-MULTI
-EXEC
transaction (see RedisOp for more details).Note that the client does not handle optimistic lock failures (which happen when watched key is modified by other client). An OptimisticLockException is returned in such cases and you must recover from it manually.
Execution of a RedisOp may also fail for the same reasons as specified for RedisBatch in executeBatch. Be especially careful when using node clients obtained from cluster client.
- Definition Classes
- RedisNodeClient → RedisOpExecutor
-
def
executionContext: commons.ExecutionContext
- Definition Classes
- RedisNodeClient → RedisExecutor
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
initialized: commons.Future[RedisNodeClient.this.type]
Waits until all Redis connections are initialized and
initOp
is executed.Waits until all Redis connections are initialized and
initOp
is executed. Note that you can call executeBatch and executeOp even if the client is not yet initialized - requests will be internally queued and executed after initialization is complete. -
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )