Trait/Object

colossus.protocols.redis

RedisClient

Related Docs: object RedisClient | package redis

Permalink

trait RedisClient[M[_]] extends AnyRef

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.

Self Type
RedisClient[M] with ResponseAdapter[Redis, M]
Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. RedisClient
  2. AnyRef
  3. 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. 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. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  16. def executeCommand[T](c: Command, key: ByteString)(goodCase: PartialFunction[Reply, M[T]]): M[T]

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

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

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

    Permalink
  20. def finalize(): Unit

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

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

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

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

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

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

    Permalink
  27. def hashCode(): Int

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Permalink
  90. def set(key: ByteString, value: ByteString): M[Boolean]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Permalink
  111. final def wait(): Unit

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Permalink
  136. 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 AnyRef

Inherited from Any

Ungrouped