t

scredis.commands

StringCommands

trait StringCommands extends AnyRef

This trait implements string commands.

Self Type
StringCommands with NonBlockingConnection
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. StringCommands
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def append[W](key: String, value: W)(implicit arg0: Writer[W]): Future[Long]

    Appends a value to a key.

    Appends a value to a key.

    key

    the key to be appended

    value

    the value to append

    returns

    the length of the string after the append operation

    Since

    2.0.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the value stored at key is not of type string

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def bitCount(key: String, start: Long = 0, stop: Long = -1): Future[Long]

    Counts the number of bits set to 1 in a string from start offset to stop offset.

    Counts the number of bits set to 1 in a string from start offset to stop offset.

    key

    the key for which the bitcount should be returned

    start

    start offset (defaults to 0)

    stop

    stop offset (defaults to -1)

    returns

    the number of bits set to 1 in the specified interval

    Since

    2.6.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the value stored at key is not of type string

    Note

    Non-existent keys are treated as empty strings, so the command will return zero.

  7. def bitOp(operation: BitOp, destKey: String, keys: String*): Future[Long]

    Performs a bitwise operation between multiple strings.

    Performs a bitwise operation between multiple strings.

    operation

    scredis.BitOp to perform

    destKey

    destination key where the result of the operation will be stored

    keys

    keys to perform the operation upon

    returns

    the size of the string stored in the destination key, that is equal to the size of the longest input string

    Since

    2.6.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if at least one of the values stored at keys is not of type string

    Note

    When an operation is performed between strings having different lengths, all the strings shorter than the longest string in the set are treated as if they were zero-padded up to the length of the longest string. The same holds true for non-existent keys, that are considered as a stream of zero bytes up to the length of the longest string.

  8. def bitPos(key: String, bit: Boolean, start: Long = 0, stop: Long = -1): Future[Long]

    Return the position of the first bit set to 1 or 0 in a string.

    Return the position of the first bit set to 1 or 0 in a string.

    key

    string key

    bit

    provide true to look for 1s and false to look for 0s

    start

    start offset, in bytes

    stop

    stop offset, in bytes

    returns

    the position of the first bit set to 1 or 0, according to the request

    Since

    2.8.7

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if key is not of type string

    Note

    The position is returned thinking at the string as an array of bits from left to right where the first byte most significant bit is at position 0, the second byte most significant big is at position 8 and so forth. The range is interpreted as a range of bytes and not a range of bits, so start=0 and end=2 means to look at the first three bytes. If we look for set bits (the bit argument is 1) and the string is empty or composed of just zero bytes, -1 is returned. If we look for clear bits (the bit argument is 0) and the string only contains bit set to 1, the function returns the first bit not part of the string on the right. So if the string is tree bytes set to the value 0xff the command BITPOS key 0 will return 24, since up to bit 23 all the bits are 1. Basically the function consider the right of the string as padded with zeros if you look for clear bits and specify no range or the start argument only. However this behavior changes if you are looking for clear bits and specify a range with both start and stop. If no clear bit is found in the specified range, the function returns -1 as the user specified a clear range and there are no 0 bits in that range.

  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  10. def decr(key: String): Future[Long]

    Decrements the integer value of a key by one.

    Decrements the integer value of a key by one.

    key

    the key to decrement

    returns

    the value of key after the decrement

    Since

    1.0.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the key contains a value of the wrong type or contains a string that cannot be represented as integer

    Note

    If the key does not exist, it is set to 0 before performing the operation.

  11. def decrBy(key: String, decrement: Long): Future[Long]

    Decrements the integer value of a key by the given amount.

    Decrements the integer value of a key by the given amount.

    key

    the key to decrement

    decrement

    the decrement

    returns

    the value of key after the decrement

    Since

    1.0.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the key contains a value of the wrong type or contains a string that cannot be represented as integer

    Note

    If the key does not exist, it is set to 0 before performing the operation.

  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  15. def get[R](key: String)(implicit arg0: Reader[R]): Future[Option[R]]

    Returns the value stored at key.

    Returns the value stored at key.

    key

    the target key

    returns

    value stored at key, or None if the key does not exist

    Since

    1.0.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the value stored at key is not of type string

  16. def getBit(key: String, offset: Long): Future[Boolean]

    Returns the bit value at offset in the string value stored at key.

    Returns the bit value at offset in the string value stored at key.

    key

    the target key

    offset

    the position in the string

    returns

    true if the bit is set to 1, false otherwise

    Since

    2.2.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the value stored at key is not of type string

  17. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. def getRange[R](key: String, start: Long, stop: Long)(implicit arg0: Reader[R]): Future[R]

    Returns a substring of the string stored at a key.

    Returns a substring of the string stored at a key.

    key

    the target key

    start

    the start offset (inclusive)

    stop

    the stop offset (inclusive)

    returns

    the substring determined by the specified offsets, or the empty string if the key does not exist

    Since

    2.4.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the value stored at key is not of type string

    Note

    Both offsets are inclusive, i.e. [start, stop]. The function handles out of range requests by limiting the resulting range to the actual length of the string.

  19. def getSet[R, W](key: String, value: W)(implicit arg0: Reader[R], arg1: Writer[W]): Future[Option[R]]

    Sets the string value of a key and return its old value.

    Sets the string value of a key and return its old value.

    key

    the target key

    value

    the value to set key to

    returns

    the old value, or None if the latter did not exist

    Since

    1.0.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the value stored at key is not of type string

  20. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  21. def incr(key: String): Future[Long]

    Increments the integer value of a key by one.

    Increments the integer value of a key by one.

    key

    the key to increment

    returns

    the value of key after the increment

    Since

    1.0.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the key contains a value of the wrong type or contains a string that cannot be represented as integer

    Note

    If the key does not exist, it is set to 0 before performing the operation.

  22. def incrBy(key: String, increment: Long): Future[Long]

    Increments the integer value of a key by the given amount.

    Increments the integer value of a key by the given amount.

    key

    the key to increment

    increment

    the increment

    returns

    the value of key after the decrement

    Since

    1.0.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the key contains a value of the wrong type or contains a string that cannot be represented as integer

    Note

    If the key does not exist, it is set to 0 before performing the operation.

  23. def incrByFloat(key: String, increment: Double): Future[Double]

    Increment the float value of a key by the given amount.

    Increment the float value of a key by the given amount.

    key

    the key to increment

    increment

    the increment

    returns

    the value of key after the decrement

    Since

    2.6.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the key contains a value of the wrong type, the current key content or the specified increment are not parseable as a double precision floating point number

    Note

    If the key does not exist, it is set to 0 before performing the operation.

  24. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  25. def mGet[R](keys: String*)(implicit arg0: Reader[R]): Future[List[Option[R]]]

    Returns the values of all specified keys.

    Returns the values of all specified keys.

    keys

    the keys to fetch

    returns

    list of value(s) stored at the specified key(s)

    Since

    1.0.0

    Note

    For every key that does not hold a string value or does not exist, None is returned. Because of this, the operation never fails.

  26. def mGetAsMap[R](keys: String*)(implicit arg0: Reader[R]): Future[Map[String, R]]

    Returns a Map containing the specified key(s) paired to their respective value(s).

    Returns a Map containing the specified key(s) paired to their respective value(s).

    keys

    the keys to fetch

    returns

    map of key-value pairs

    Since

    1.0.0

    Note

    Every key that does not hold a string value or does not exist will be removed from the resulting Map.

  27. def mSet[W](keyValuePairs: Map[String, W])(implicit arg0: Writer[W]): Future[Unit]

    Atomically sets multiple keys to multiple values.

    Atomically sets multiple keys to multiple values.

    keyValuePairs

    map of key-value pairs to set

    Since

    1.0.1

    Note

    MSET replaces existing values with new values, just as regular SET.

  28. def mSetNX[W](keyValuePairs: Map[String, W])(implicit arg0: Writer[W]): Future[Boolean]

    Atomically sets multiple keys to multiple values, only if none of the keys exist.

    Atomically sets multiple keys to multiple values, only if none of the keys exist.

    keyValuePairs

    map of key-value pairs to set

    returns

    true if all the keys were set, false if at least one key already existed and thus no operation was performed.

    Since

    1.0.1

    Note

    MSETNX will not perform any operation at all even if just a single key already exists.

  29. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  30. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  31. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  32. def pSetEX[W](key: String, value: W, ttlMillis: Long)(implicit arg0: Writer[W]): Future[Unit]

    Sets the value and expiration in milliseconds of a key.

    Sets the value and expiration in milliseconds of a key.

    key

    target key to set

    value

    value to be stored at key

    ttlMillis

    time-to-live in milliseconds

    Since

    2.6.0

    Note

    If key already holds a value, it is overwritten, regardless of its type.

  33. def set[W](key: String, value: W, ttlOpt: Option[FiniteDuration] = None, conditionOpt: Option[Condition] = None)(implicit arg0: Writer[W]): Future[Boolean]

    Sets the string value of a key.

    Sets the string value of a key.

    key

    target key to set

    value

    value to be stored at key

    ttlOpt

    optional time-to-live (up to milliseconds precision)

    conditionOpt

    optional condition to be met for the value to be set

    returns

    true if the value was set correctly, false if a condition was specified but not met

    Since

    1.0.0

    Note

    If key already holds a value, it is overwritten, regardless of its type. Any previous time to live associated with the key is discarded on successful SET operation. The ttlOpt and conditionOpt parameters can only be used with Redis >= 2.6.12

  34. def setBit(key: String, offset: Long, bit: Boolean): Future[Boolean]

    Sets or clears the bit at offset in the string value stored at key.

    Sets or clears the bit at offset in the string value stored at key.

    key

    key for which the bit should be set

    offset

    position where the bit should be set

    bit

    true sets the bit to 1, false sets it to 0

    Since

    2.2.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the key contains a value of the wrong type

    Note

    When key does not exist, a new string value is created. The string is grown to make sure it can hold a bit at offset. When the string at key is grown, added bits are set to 0.

  35. def setEX[W](key: String, value: W, ttlSeconds: Int)(implicit arg0: Writer[W]): Future[Unit]

    Sets the value and expiration in seconds of a key.

    Sets the value and expiration in seconds of a key.

    key

    target key to set

    value

    value to be stored at key

    ttlSeconds

    time-to-live in seconds

    Since

    2.0.0

    Note

    If key already holds a value, it is overwritten, regardless of its type.

  36. def setNX[W](key: String, value: W)(implicit arg0: Writer[W]): Future[Boolean]

    Sets the value of a key, only if the key does not exist.

    Sets the value of a key, only if the key does not exist.

    key

    target key to set

    value

    value to be stored at key

    returns

    true if the key was set, false otherwise

    Since

    1.0.0

  37. def setRange[W](key: String, offset: Long, value: W)(implicit arg0: Writer[W]): Future[Long]

    Overwrites part of a string at key starting at the specified offset.

    Overwrites part of a string at key starting at the specified offset.

    key

    target key

    offset

    position from which the string must be overwritten

    value

    string value to be set at given offset

    returns

    the length of the string after it was modified by the command

    Since

    2.2.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the key contains a value of the wrong type

    Note

    If the offset is larger than the current length of the string at key, the string is padded with zero-bytes to make offset fit. Non-existing keys are considered as empty strings, so this command will make sure it holds a string large enough to be able to set value at offset.

  38. def strLen(key: String): Future[Long]

    Returns the length of the string value stored in a key.

    Returns the length of the string value stored in a key.

    key

    target key

    returns

    the length of the string stored at key, or 0 when the key does not exist

    Since

    2.2.0

    Exceptions thrown

    [[scredis.exceptions.RedisErrorResponseException]] if the key contains a value of the wrong type

  39. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  40. def toString(): String
    Definition Classes
    AnyRef → Any
  41. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  42. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  43. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped