Trait/Object

colossus.protocols.redis

RedisClient

Related Docs: object RedisClient | package redis

Permalink

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.

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
Visibility
  1. Public
  2. All

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. def append(key: ByteString, value: ByteString): M[Long]

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. implicit val async: Async[M]

    Permalink
    Definition Classes
    LiftedClient
  7. def bulkReplyAsDoubleCommand(c: Command, key: ByteString): M[Double]

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

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

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

    Permalink
    Attributes
    protected
  11. val client: Sender[Redis, M]

    Permalink
    Definition Classes
    LiftedClient
  12. def clone(): AnyRef

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

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

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

    Permalink
  16. def disconnect(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  19. def executeAndMap[T](i: Input)(f: (Output) ⇒ M[T]): M[T]

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

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

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

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

    Permalink
  24. def finalize(): Unit

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

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

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

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

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

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

    Permalink
  31. def hashCode(): Int

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Permalink
  94. def send(input: Input): M[Output]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Permalink
  116. final def wait(): Unit

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

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

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

    Permalink

    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.

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

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

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

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

    Permalink

    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")
  124. def zlexcount(key: ByteString, min: ByteString = ByteString("-"), max: ByteString = ByteString("+")): M[Long]

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

    Permalink

    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.

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

    Permalink

    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

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

    Permalink

    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

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

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

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

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

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

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

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

    Permalink

    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.

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

    Permalink

    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

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

    Permalink

    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

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

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

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

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

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

    Permalink

    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")

Inherited from LiftedClient[Redis, M]

Inherited from Sender[Redis, M]

Inherited from AnyRef

Inherited from Any

Ungrouped