trait RedisBatch[+A] extends AnyRef
Represents a Redis command or a set of commands sent to Redis as a single batch (usually in a single network message).
RedisBatch yields a result of type A
which is decoded from responses to commands from this batch.
Execution of a batch may also fail for various reasons. Therefore, RedisBatch contains API that allows
to recover from failures, e.g. RedisBatch.tried.
RedisBatches may be combined with each other to form bigger batches. The simpliest primitive for combining batches is RedisBatch.map2 operation while the most convenient way is by using RedisBatch.sequence operation which is powered by Sequencer typeclass.
RedisBatch can be turned into a RedisOp or executed by RedisExecutor (e.g. one of Redis client implementations).
- A
result yield by this batch
- Self Type
- RedisBatch[A]
- Alphabetic
- By Inheritance
- RedisBatch
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
- abstract def decodeReplies(replies: (Int) ⇒ RedisReply, index: Index = new Index, inTransaction: Boolean = false): A
- abstract def rawCommandPacks: RawCommandPacks
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
*>[B](other: RedisBatch[B]): RedisBatch[B]
Merges two batches into a single batch where result of the right-hand-side batch is returned while result of left-hand-side is discarded.
Merges two batches into a single batch where result of the right-hand-side batch is returned while result of left-hand-side is discarded. Useful when left-hand-side returns
Unit
. NOTE: errors for left-hand-side are NOT discarded, use ignoreFailures on it if that's your intention. -
def
<*[B](other: RedisBatch[B]): RedisBatch[A]
Merges two batches into a single batch where result of the left-hand-side batch is returned while result of right-hand-side is discarded.
Merges two batches into a single batch where result of the left-hand-side batch is returned while result of right-hand-side is discarded. Useful when right-hand-side returns
Unit
. NOTE: errors for right-hand-side are NOT discarded, use ignoreFailures on it if that's your intention. -
def
<*>[B, C](other: RedisBatch[B])(f: (A, B) ⇒ C): RedisBatch[C]
This is a symbolic alias for map2.
This is a symbolic alias for map2. The symbol (along with *> and <*) is inspired by its Haskell equivalent.
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asking: RedisBatch[A]
Ensures that every keyed command in this batch is prepended with
ASKING
special command.Ensures that every keyed command in this batch is prepended with
ASKING
special command. This is necessary only when manually handling Redis Cluster redirections. -
def
atomic: RedisBatch[A]
Returns a batch which invokes the same commands as this batch but atomically.
Returns a batch which invokes the same commands as this batch but atomically. If this batch is already atomic then it's returned unchanged. Otherwise, it's wrapped into a Redis transaction (
MULTI
-EXEC
block). Empty batches, single-command batches and transactions are atomic by themselves and therefore are returned unchanged. -
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def failed: RedisBatch[Throwable]
-
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 ignoreFailures: RedisBatch[Unit]
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[B](f: (A) ⇒ B): RedisBatch[B]
-
def
map2[B, C](other: RedisBatch[B])(f: (A, B) ⇒ C): RedisBatch[C]
Merges two batches into one.
Merges two batches into one. Provided function is applied on results of the batches being merged to obtain result of the merged batch.
map2
is the fundamental primitive for composing multiple batches into one. -
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()
-
def
operation: RedisOp[A]
Transforms this batch into a RedisOp.
- def recover[B >: A](f: PartialFunction[Throwable, B]): RedisBatch[B]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
transaction: RedisBatch[A]
Wraps this batch into a Redis transaction, i.e.
Wraps this batch into a Redis transaction, i.e. ensures that it's executed inside a
MULTI
-EXEC
block. NOTE: If you simply want to ensure atomicity, use atomic. NOTE: You can safely nest transactions, the driver will make sure that there are no nestedMULTI
-EXEC
blocks on the wire. - def transform[B](fun: (commons.Try[A]) ⇒ commons.Try[B]): RedisBatch[B]
- def tried: RedisBatch[commons.Try[A]]
-
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( ... )
- def zip[B](other: RedisBatch[B]): RedisBatch[(A, B)]