colossus.protocols.redis

RedisClient

trait RedisClient[M[_]] extends LiftedClient[Redis, M]

This trait houses the Redis API. It contains implementations for most(not all) commands. In particular, this trait makes a best attempt at providing all implementations for: - Key commands - String commands - Hash commands - List commands - Set commands - Zset commands

Commands not implemented yet are

Just because these commands are not implemented, doesn't mean they cannot be used. The implementors of this trait provide a generic 'execute' command, which allows for the execution of arbitrary colossus.protocols.redis.Commandobjects. The calling code is responsible for handling the raw colossus.protocols.redis.Reply.

In some cases if a command can return an optional response(ie: a bulk reply or nil reply, like 'get'), 2 variants are provided. One which will return the data directly, and fail if its not there, and another which returns an Option. This is done to provide the user with some flexibility in how they query data. The point being, if you want to query and fail on non existence, you don't have to deal w/ an intermediate Option.

No camelcase? Yea..camelcasing redis commands looked and felt weird. MGet? mGet? mget? mSetNx? msetNX? etc. So, since all redis commands are uppercased(at least in the docs), I went with all lower case for the API. I just wanted something consistent looking. The only camelcasing is for the functions which return options ie: getOption.

This trait tries its best to be redis version agonstic. It doesn't know anything about the version of redis you are communicating with, so, for example, if an 'hstrlen' command is issued to a redis server that's < 3.2, you will get an Exception.

Some commands(mainly zset commands) have additional arguments which alter its behavior. Instead of trying to capture all the argument combinations the function provides a varargs ByteString so that the user can provide whatever trailing flags or options they want. Each command which has this behavior is noted in its docs.

M

Linear Supertypes
LiftedClient[Redis, M], Sender[Redis, M], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. RedisClient
  2. LiftedClient
  3. Sender
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. implicit abstract val async: Async[M]

    Definition Classes
    LiftedClient
  2. abstract def client: Sender[Redis, M]

    Definition Classes
    LiftedClient
  3. abstract def clientConfig: Option[ClientConfig]

    Definition Classes
    LiftedClient

Concrete Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def append(key: ByteString, value: ByteString): M[Long]

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def bulkReplyAsDoubleCommand(c: Command, key: ByteString): M[Double]

    Attributes
    protected
  9. def bulkReplyAsDoubleOptionCommand(c: Command, key: ByteString): M[Option[Double]]

    Attributes
    protected
  10. def bulkReplyCommand(c: Command, key: ByteString): M[ByteString]

    Attributes
    protected
  11. def bulkReplyOptionCommand(c: Command, key: ByteString): M[Option[ByteString]]

    Attributes
    protected
  12. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. def decr(key: ByteString): M[Long]

  14. def decrBy(key: ByteString, amount: Long): M[Long]

  15. def del(keys: ByteString*): M[Long]

  16. def disconnect(): Unit

    Definition Classes
    LiftedClientSender
  17. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  19. def executeAndMap[T](i: Request)(f: (Response) ⇒ M[T]): M[T]

    Attributes
    protected
    Definition Classes
    LiftedClient
  20. def executeCommand[T](c: Command, key: ByteString)(goodCase: PartialFunction[Reply, M[T]]): M[T]

    Attributes
    protected
  21. def exists(key: ByteString): M[Boolean]

  22. def expire(key: ByteString, ttl: FiniteDuration): M[Boolean]

  23. def expireat(key: ByteString, unixTimeInSeconds: Long): M[Boolean]

  24. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  25. def get(key: ByteString): M[ByteString]

  26. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  27. def getOption(key: ByteString): M[Option[ByteString]]

  28. def getrange(key: ByteString, from: Long, to: Long): M[ByteString]

  29. def getset(key: ByteString, value: ByteString): M[ByteString]

  30. def getsetOption(key: ByteString, value: ByteString): M[Option[ByteString]]

  31. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  32. def hdel(key: ByteString, fields: ByteString*): M[Long]

  33. def hexists(key: ByteString, field: ByteString): M[Boolean]

  34. def hget(key: ByteString, field: ByteString): M[ByteString]

  35. def hgetOption(key: ByteString, field: ByteString): M[Option[ByteString]]

  36. def hgetall(key: ByteString): M[Seq[ByteString]]

  37. def hincrby(key: ByteString, field: ByteString, amount: Long): M[Long]

  38. def hincrbyfloat(key: ByteString, field: ByteString, amount: Double): M[Double]

  39. def hkeys(key: ByteString): M[Seq[ByteString]]

  40. def hlen(key: ByteString): M[Long]

  41. def hmget(key: ByteString, fields: ByteString*): M[Seq[Option[ByteString]]]

  42. def hmset(key: ByteString, fields: ByteString*): M[Boolean]

  43. def hset(key: ByteString, field: ByteString, value: ByteString): M[Boolean]

  44. def hsetnx(key: ByteString, field: ByteString, value: ByteString): M[Boolean]

  45. def hstrlen(key: ByteString, field: ByteString): M[Long]

  46. def hvals(key: ByteString): M[Seq[ByteString]]

  47. def incr(key: ByteString): M[Long]

  48. def incrby(key: ByteString, amount: Long): M[Long]

  49. def incrbyfloat(key: ByteString, amount: Double): M[Double]

  50. def integerReplyBoolCommand(c: Command, key: ByteString): M[Boolean]

    Attributes
    protected
  51. def integerReplyCommand(c: Command, key: ByteString): M[Long]

    Attributes
    protected
  52. def integerReplyOptionCommand(c: Command, key: ByteString): M[Option[Long]]

    Attributes
    protected
  53. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  54. def keys(key: ByteString): M[Seq[ByteString]]

  55. def lindex(key: ByteString, index: Long): M[ByteString]

  56. def lindexOption(key: ByteString, index: Long): M[Option[ByteString]]

  57. def linsertAfter(key: ByteString, pivotValue: ByteString, value: ByteString): M[Long]

  58. def linsertBefore(key: ByteString, pivotValue: ByteString, value: ByteString): M[Long]

  59. def llen(key: ByteString): M[Long]

  60. def lpop(key: ByteString): M[ByteString]

  61. def lpopOption(key: ByteString): M[Option[ByteString]]

  62. def lpush(key: ByteString, values: ByteString*): M[Long]

  63. def lpushx(key: ByteString, value: ByteString): M[Long]

  64. def lrange(key: ByteString, start: Long, end: Long): M[Seq[ByteString]]

  65. def lrem(key: ByteString, count: Long, value: ByteString): M[Long]

  66. def lset(key: ByteString, index: Long, value: ByteString): M[Boolean]

  67. def ltrim(key: ByteString, start: Long, end: Long): M[Boolean]

  68. def mBulkReplyCommand(c: Command, key: ByteString): M[Seq[ByteString]]

    Attributes
    protected
  69. def mBulkReplyOptionCommand(c: Command, key: ByteString): M[Seq[Option[ByteString]]]

    Attributes
    protected
  70. def mget(keys: ByteString*): M[Seq[Option[ByteString]]]

  71. def mset(keysAndValues: ByteString*): M[Boolean]

  72. def msetnx(keysAndValues: ByteString*): M[Boolean]

  73. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  74. final def notify(): Unit

    Definition Classes
    AnyRef
  75. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  76. def persist(key: ByteString): M[Boolean]

  77. def pexpire(key: ByteString, ttl: FiniteDuration): M[Boolean]

  78. def pexpireat(key: ByteString, unixTimeInMillis: Long): M[Boolean]

  79. def psetex(key: ByteString, value: ByteString, ttl: FiniteDuration): M[Boolean]

  80. def pttl(key: ByteString): M[Long]

  81. def randomkey(): M[Option[ByteString]]

  82. def rename(source: ByteString, destination: ByteString): M[Boolean]

  83. def renamenx(source: ByteString, destination: ByteString): M[Boolean]

  84. def rpop(key: ByteString): M[ByteString]

  85. def rpopOption(key: ByteString): M[Option[ByteString]]

  86. def rpoplpush(key: ByteString, destination: ByteString): M[ByteString]

  87. def rpoplpushOption(key: ByteString, destination: ByteString): M[Option[ByteString]]

  88. def rpush(key: ByteString, values: ByteString*): M[Long]

  89. def rpushx(key: ByteString, value: ByteString): M[Long]

  90. def sadd(key: ByteString, values: ByteString*): M[Long]

  91. def scard(key: ByteString): M[Long]

  92. def sdiff(key: ByteString, keys: ByteString*): M[Set[ByteString]]

  93. def sdiffstore(destination: ByteString, key: ByteString, keys: ByteString*): M[Long]

  94. def send(input: Request): M[Response]

    Definition Classes
    LiftedClientSender
  95. def set(key: ByteString, value: ByteString, notExists: Boolean = false, exists: Boolean = false, ttl: Duration = Duration.Inf): M[Boolean]

  96. def setex(key: ByteString, value: ByteString, ttl: FiniteDuration): M[Boolean]

  97. def setnx(key: ByteString, value: ByteString): M[Boolean]

  98. def sinter(key: ByteString, keys: ByteString*): M[Set[ByteString]]

  99. def sinterstore(destination: ByteString, key: ByteString, keys: ByteString*): M[Long]

  100. def sismember(key: ByteString, value: ByteString): M[Boolean]

  101. def smembers(key: ByteString): M[Set[ByteString]]

  102. def smove(source: ByteString, destination: ByteString, value: ByteString): M[Boolean]

  103. def spop(key: ByteString): M[ByteString]

  104. def spopOption(key: ByteString): M[Option[ByteString]]

  105. def srandmember(key: ByteString, count: Long): M[Seq[ByteString]]

  106. def srandmember(key: ByteString): M[ByteString]

  107. def srandmemberOption(key: ByteString): M[Option[ByteString]]

  108. def srem(key: ByteString, values: ByteString*): M[Long]

  109. def stringReplyCommand(c: Command, key: ByteString): M[Boolean]

    Attributes
    protected
  110. def strlen(key: ByteString): M[Long]

  111. def sunion(key: ByteString, keys: ByteString*): M[Set[ByteString]]

  112. def sunionstore(destination: ByteString, key: ByteString, keys: ByteString*): M[Long]

  113. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  114. def toString(): String

    Definition Classes
    AnyRef → Any
  115. def ttl(key: ByteString): M[Long]

  116. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  119. def zadd(key: ByteString, valuesAndArguments: ByteString*): M[Double]

    This is one of the aforementioned special commands.

    This is one of the aforementioned special commands. Zadd takes a host of arguments versions >= 3.0.2, as noted in http://redis.io/commands/zadd Since this API *tries* to be redis version agnostic, it doesn't have them formally in its function definition, but they can be passed in at the beginning of the valuesAndArguments varargs parameter:

    client.zadd("key", "XX", "CH" "1", "a"....

    Also, since these flags can change the return type, can be a Long in some cases and a Double in others, a Double is returned to capture both cases.

    key
    valuesAndArguments
    returns

  120. def zcard(key: ByteString): M[Long]

  121. def zcount(key: ByteString, from: Option[Double] = None, to: Option[Double]): M[Long]

  122. def zincrby(key: ByteString, amount: Double, value: ByteString): M[Double]

  123. def zinterstore(key: ByteString, numKeys: Long, keysAndArguments: ByteString*): M[Long]

    Another command which takes optional arguments.

    Another command which takes optional arguments. Tack on additional arguments into the keysAndArguments varargs. http://redis.io/commands/zinterstore

    client.zinterstore(key, 2, keyA, keyB, "WEIGHTS", "1", "2", "AGGREGATE" "SUM")
    key
    numKeys
    keysAndArguments
    returns

  124. def zlexcount(key: ByteString, min: ByteString = ByteString("-"), max: ByteString = ByteString("+")): M[Long]

  125. def zrange(key: ByteString, start: Long, stop: Long, arguments: ByteString*): M[Seq[ByteString]]

    This command can take a 'withscores' additional argument at the end.

    This command can take a 'withscores' additional argument at the end. It changes what is included in the the results.

    http://redis.io/commands/zrange

    For now, this function is a bit raw, and a future change will have 2 versions of this function.

    key
    start
    stop
    arguments
    returns

  126. def zrangebylex(key: ByteString, min: ByteString, max: ByteString, arguments: ByteString*): M[Seq[ByteString]]

    Additional arguments for this function are the limit/offset/count options.

    Additional arguments for this function are the limit/offset/count options.

    http://redis.io/commands/zrangebylex

    key
    min
    max
    arguments
    returns

  127. def zrangebyscore(key: ByteString, min: ByteString, max: ByteString, arguments: ByteString*): M[Seq[ByteString]]

    Additional arguments for this function are the limit/offset/count options.

    Additional arguments for this function are the limit/offset/count options.

    http://redis.io/commands/zrangebyscore

    key
    min
    max
    arguments
    returns

  128. def zrank(key: ByteString, value: ByteString): M[Long]

  129. def zrankOption(key: ByteString, value: ByteString): M[Option[Long]]

  130. def zrem(key: ByteString, values: ByteString*): M[Long]

  131. def zremrangebylex(key: ByteString, min: ByteString, max: ByteString): M[Long]

  132. def zremrangebyrank(key: ByteString, start: Long, stop: Long): M[Long]

  133. def zremrangebyscore(key: ByteString, min: ByteString, max: ByteString): M[Long]

  134. def zrevrange(key: ByteString, start: Long, stop: Long, arguments: ByteString*): M[Seq[ByteString]]

    This command can take a 'withscores' additional argument at the end.

    This command can take a 'withscores' additional argument at the end. It changes what is included in the the results.

    http://redis.io/commands/zrevrange

    For now, this function is a bit raw, and a future change will have 2 versions of this function.

    key
    start
    stop
    arguments
    returns

  135. def zrevrangebylex(key: ByteString, max: ByteString, min: ByteString, arguments: ByteString*): M[Seq[ByteString]]

    Additional arguments for this function are the limit/offset/count options.

    Additional arguments for this function are the limit/offset/count options.

    http://redis.io/commands/zrevrangebylex

    key
    max
    min
    arguments
    returns

  136. def zrevrangebyscore(key: ByteString, max: ByteString, min: ByteString, arguments: ByteString*): M[Seq[ByteString]]

    Additional arguments for this function are the limit/offset/count options.

    Additional arguments for this function are the limit/offset/count options.

    http://redis.io/commands/zrevrangebyscore

    key
    max
    min
    arguments
    returns

  137. def zrevrank(key: ByteString, value: ByteString): M[Long]

  138. def zrevrankOption(key: ByteString, value: ByteString): M[Option[Long]]

  139. def zscore(key: ByteString, value: ByteString): M[Double]

  140. def zscoreOption(key: ByteString, value: ByteString): M[Option[Double]]

  141. def zunionstore(key: ByteString, numKeys: Long, keysAndArguments: ByteString*): M[Long]

    Another command which takes optional arguments.

    Another command which takes optional arguments. Tack on additional arguments into the keysAndArguments varargs. http://redis.io/commands/zunionstore

    client.zunionstore(key, 2, keyA, keyB, "WEIGHTS", "1", "2", "AGGREGATE" "SUM")
    key
    numKeys
    keysAndArguments
    returns

Inherited from LiftedClient[Redis, M]

Inherited from Sender[Redis, M]

Inherited from AnyRef

Inherited from Any

Ungrouped