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

Abstract Value Members

  1. implicit abstract val async: Async[M]

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

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

    Permalink
    Definition Classes
    LiftedClient

Concrete 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. def bulkReplyAsDoubleCommand(c: Command, key: ByteString): M[Double]

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

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

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

    Permalink
    Attributes
    protected
  10. def clone(): AnyRef

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

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

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

    Permalink
  14. def disconnect(): Unit

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

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

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

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

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

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

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

    Permalink
  22. def finalize(): Unit

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

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

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

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

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

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

    Permalink
  29. def hashCode(): Int

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Permalink
  114. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  117. 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.

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

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

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

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

    Permalink
  123. 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.

  124. 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

  125. 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

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

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

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

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

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

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

    Permalink
  132. 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.

  133. 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

  134. 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

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

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

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

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

    Permalink
  139. 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