Packages

sealed trait RedisOp[+A] extends AnyRef

Represents a sequence of Redis operations executed using a single Redis connection. Any operation may depend on the result of some previous operation (therefore, flatMap is available). RedisOp is guaranteed to be executed fully and exclusively on a single Redis connection (no other concurrent commands can be executed on that connection during execution of RedisOp). Because of that, RedisOps may execute WATCH and UNWATCH commands.

In fact, the primary purpose of RedisOp is to allow execution of Redis transactions with optimistic locking. For this purpose, RedisOp may be created by flat-mapping RedisBatches.

For example, below is an implementation of Redis transaction which fetches a value of some key (as Int) multiplies it by 3 and saves it back to Redis. During this operation, the key being modified is watched so that saving fails with OptimisticLockException if some other client concurrently modifies that key.

val api = RedisApi.Batches.StringTyped.valueType[Int]
import api._
val transactionOp: RedisOp[Unit] = for {
  // we're sending WATCH and GET commands in a single batch
  value <- watch("number") *> get("number").map(_.getOrElse(1))
  // SET command is wrapped in MULTI-EXEC block
  _ <- set("number", value * 3).transaction
} yield ()

RedisOp can be passed for execution to RedisOpExecutor (implemented by e.g. RedisNodeClient).

Self Type
RedisOp[A]
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RedisOp
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def asking: RedisOp[A]

    Ensures that every keyed command in this operation is prepended with special ASKING command.

    Ensures that every keyed command in this operation is prepended with special ASKING command. This is necessary only when manually handling Redis Cluster redirections.

  6. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def failed: RedisOp[Throwable]
  10. def fallbackTo[B >: A](op: RedisOp[B]): RedisOp[B]
  11. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def ignoreFailures: RedisOp[Unit]
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. def map[B](f: (A) ⇒ B): RedisOp[B]
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. def recover[B >: A](f: PartialFunction[Throwable, B]): RedisOp[B]
  21. def recoverWith[B >: A](fun: PartialFunction[Throwable, RedisOp[B]]): RedisOp[B]
  22. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  23. def toString(): String
    Definition Classes
    AnyRef → Any
  24. def transform[B](fun: (commons.Try[A]) ⇒ commons.Try[B]): RedisOp[B]
  25. def tried: RedisOp[commons.Try[A]]
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped