Object

com.avsystem.commons.redis

RedisApi

Related Doc: package redis

Permalink

object RedisApi

Object which contains implementations of various variants of Redis API that this driver provides. Each variant implements a set of methods corresponding directly to Redis commands, e.g. get method represents Redis GET command.

API variants may differ from each other in several independent aspects:

The most important one is the result type returned by every method corresponding to a Redis command:

Async and Blocking API variants additionally come in three different "levels", each one exposing different subset of Redis commands. This reflects the fact that not every RedisExecutor (client implementation) supports every command (e.g. you can't execute unkeyed commands using RedisClusterClient).

Every API variant may also use different types to represent Redis keys, hash keys and values. You can define your own API variants for arbitrary combination of key, hash key and value types as long as there is an instance of RedisDataCodec for every of these types.

For example, if you keep only numeric values on a Redis Cluster installation, you might define an API variant like this one:

class NumericKeyedAsyncApi(executor: RedisKeyedExecutor, config: ExecutionConfig = ExecutionConfig.Default)
  extends RedisApi.Keyed.Async[String,String,Long](executor, config)

API variants which use only Strings (textual) or only ByteStrings (binary) are already implemented by the driver, e.g. RedisApi.Keyed.Async.StringTyped, RedisApi.Batches.BinaryTyped.

Note that RedisDataCodec is automatically provided for many simple types and also all types which have a GenCodec. This effectively gives you a complete serialization framework for keys, hash keys and values stored in Redis.

Note that chosen key, hash key and value types can be adjusted "on the fly" with a convenient syntax. For example, if you need to use some case class as a value type in a single, specific place, you can do it without defining a completely separate API variant. For example:

case class Person(name: String, birthYear: Int)
object Person {
  implicit val codec: GenCodec[Person] = GenCodec.materialize[Person]
}

import scala.concurrent.duration._
implicit val system: ActorSystem = ActorSystem()

val api = RedisApi.Keyed.Blocking.StringTyped(new RedisClusterClient)

// normally, we're just using String-typed API
api.set("key", "value")

// but in one specific place, we might want to use Person as the value
// Person has an instance of GenCodec, so it will be automatically serialized to binary format
api.valueType[Person].set("binaryDataKey", Person("Fred", 1990))
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RedisApi
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class Batches[Key, HashKey, Value] extends AbstractRedisApi[Batches, Key, HashKey, Value] with RedisConnectionApi with RedisBatchApi

    Permalink
  2. class Raw[Key, HashKey, Value] extends AbstractRedisApi[Raw, Key, HashKey, Value] with RedisConnectionApi with RedisRawApi

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object Batches

    Permalink

    Entry point for API variants which return RedisBatches.

  5. object Connection

    Permalink

    Entry point for API variants which expose all commands, including connection-level ones, i.e.

    Entry point for API variants which expose all commands, including connection-level ones, i.e. the ones that access or modify Redis connection state.

  6. object Keyed

    Permalink

    Entry point for API variants which expose only keyed commands.

  7. object Node

    Permalink

    Entry point for API variants which expose node-level commands, i.e.

    Entry point for API variants which expose node-level commands, i.e. the ones that don't access or modify Redis connection state.

  8. object Raw

    Permalink

    Entry point for API variants which return RawCommands.

  9. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  21. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  22. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped