Packages

c

com.avsystem.commons.redis

RedisNodeClient

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
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RedisNodeClient
  2. Closeable
  3. AutoCloseable
  4. RedisNodeExecutor
  5. RedisOpExecutor
  6. RedisKeyedExecutor
  7. RedisExecutor
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RedisNodeClient(address: NodeAddress = NodeAddress.Default, config: NodeConfig = NodeConfig(), clusterNode: Boolean = false)(implicit system: ActorSystem)

Value Members

  1. val address: NodeAddress
  2. def close(): Unit
    Definition Classes
    RedisNodeClient → Closeable → AutoCloseable
  3. val clusterNode: Boolean
  4. val config: NodeConfig
  5. 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:

    Definition Classes
    RedisNodeClientRedisExecutor
  6. 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
    RedisNodeClientRedisOpExecutor
  7. def executionContext: commons.ExecutionContext
    Definition Classes
    RedisNodeClientRedisExecutor
  8. 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.