scredis.commands

StringsCommands

trait StringsCommands extends AnyRef

This trait implements strings commands.

Self Type
StringsCommands with Protocol
Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. StringsCommands
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

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(key: String, value: Any)(implicit opts: CommandOptions = DefaultCommandOptions): 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.RedisCommandException]]

    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)(implicit opts: CommandOptions = DefaultCommandOptions): Long

    Counts the number of bits set to 1 in a string.

    Counts the number of bits set to 1 in a string.

    key

    the key for which the bitcount should be returned

    returns

    the number of bits set to 1

    Since

    2.6.0

    Exceptions thrown
    [[scredis.exceptions.RedisCommandException]]

    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 bitCountInRange(key: String, start: Long, end: Long)(implicit opts: CommandOptions = DefaultCommandOptions): Long

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

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

    key

    the key for which the bitcount should be returned

    start

    start offset in bytes

    end

    end offset in bytes

    returns

    the number of bits set to 1 in the specified interval

    Since

    2.6.0

    Exceptions thrown
    [[scredis.exceptions.RedisCommandException]]

    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.

  8. def bitOpAnd(key1: String, key2: String, destKey: String)(implicit opts: CommandOptions = DefaultCommandOptions): Long

    Performs bitwise AND operation between two strings.

    Performs bitwise AND operation between two strings.

    key1

    left operand

    key2

    right operand

    destKey

    key where the result of the operation will be stored

    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.RedisCommandException]]

    if the value stored at key 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.

  9. def bitOpNot(key: String, destKey: String)(implicit opts: CommandOptions = DefaultCommandOptions): Long

    Performs bitwise NOT operation on a given string.

    Performs bitwise NOT operation on a given string.

    key

    the source key

    destKey

    key where the result of the operation will be stored

    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.RedisCommandException]]

    if the value stored at key is not of type string

  10. def bitOpOr(key1: String, key2: String, destKey: String)(implicit opts: CommandOptions = DefaultCommandOptions): Long

    Performs bitwise OR operation between two strings.

    Performs bitwise OR operation between two strings.

    key1

    left operand

    key2

    right operand

    destKey

    key where the result of the operation will be stored

    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.RedisCommandException]]

    if the value stored at key 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.

  11. def bitOpXor(key1: String, key2: String, destKey: String)(implicit opts: CommandOptions = DefaultCommandOptions): Long

    Performs bitwise XOR operation between two strings.

    Performs bitwise XOR operation between two strings.

    key1

    left operand

    key2

    right operand

    destKey

    key where the result of the operation will be stored

    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.RedisCommandException]]

    if the value stored at key 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.

  12. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. def decr(key: String)(implicit opts: CommandOptions = DefaultCommandOptions): 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.RedisCommandException]]

    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.

  14. def decrBy(key: String, count: Long)(implicit opts: CommandOptions = DefaultCommandOptions): 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

    count

    the decrement

    returns

    the value of key after the decrement

    Since

    1.0.0

    Exceptions thrown
    [[scredis.exceptions.RedisCommandException]]

    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.

  15. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  17. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. def get[A](key: String)(implicit opts: CommandOptions = DefaultCommandOptions, parser: Parser[A] = StringParser): Option[A]

    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.RedisCommandException]]

    if the value stored at key is not of type string

  19. def getBit(key: String, offset: Long)(implicit opts: CommandOptions = DefaultCommandOptions): 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.RedisCommandException]]

    if the value stored at key is not of type string

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

    Definition Classes
    AnyRef → Any
  21. def getRange[A](key: String, start: Long, end: Long)(implicit opts: CommandOptions = DefaultCommandOptions, parser: Parser[A] = StringParser): A

    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)

    end

    the end offset (inclusive)

    returns

    the substring determined by the specified offsets

    Since

    2.4.0

    Exceptions thrown
    [[scredis.exceptions.RedisCommandException]]

    if the value stored at key is not of type string

    Note

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

  22. def getSet[A](key: String, value: Any)(implicit opts: CommandOptions = DefaultCommandOptions, parser: Parser[A] = StringParser): Option[A]

    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.RedisCommandException]]

    if the value stored at key is not of type string

  23. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  24. def incr(key: String)(implicit opts: CommandOptions = DefaultCommandOptions): 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.RedisCommandException]]

    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.

  25. def incrBy(key: String, count: Long)(implicit opts: CommandOptions = DefaultCommandOptions): 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

    count

    the increment

    returns

    the value of key after the decrement

    Since

    1.0.0

    Exceptions thrown
    [[scredis.exceptions.RedisCommandException]]

    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.

  26. def incrByFloat(key: String, count: Double)(implicit opts: CommandOptions = DefaultCommandOptions): 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

    count

    the increment

    returns

    the value of key after the decrement

    Since

    2.6.0

    Exceptions thrown
    [[scredis.exceptions.RedisCommandException]]

    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.

  27. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  28. def mGet[A](key: String, keys: String*)(implicit opts: CommandOptions = DefaultCommandOptions, parser: Parser[A] = StringParser): List[Option[A]]

    Returns the values of all specified keys.

    Returns the values of all specified keys.

    key

    the target key

    keys

    additional keys

    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.

  29. def mGetAsMap[A](key: String, keys: String*)(implicit opts: CommandOptions = DefaultCommandOptions, parser: Parser[A] = StringParser): Map[String, A]

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

    key

    the target key

    keys

    additional keys

    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.

  30. def mSet(keyValuePair: (String, Any), keyValuePairs: (String, Any)*)(implicit opts: CommandOptions = DefaultCommandOptions): Unit

    Atomically sets multiple keys to multiple values.

    Atomically sets multiple keys to multiple values.

    keyValuePair

    key-value pair to be set

    keyValuePairs

    additional key-value pairs to be set

    Since

    1.0.1

    Note

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

  31. def mSetFromMap(keyValueMap: Map[String, Any])(implicit opts: CommandOptions = DefaultCommandOptions): Unit

    Atomically sets multiple keys to multiple values.

    Atomically sets multiple keys to multiple values.

    keyValueMap

    key-value pairs to be set

    Since

    1.0.1

    Exceptions thrown
    [[scredis.exceptions.RedisCommandException]]

    if the provided keyValueMap is empty

    Note

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

  32. def mSetNX(keyValuePair: (String, Any), keyValuePairs: (String, Any)*)(implicit opts: CommandOptions = DefaultCommandOptions): 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.

    keyValuePair

    key-value pair to be set

    keyValuePairs

    additional key-value pairs to be set

    Since

    1.0.1

    Note

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

  33. def mSetNXFromMap(keyValueMap: Map[String, Any])(implicit opts: CommandOptions = DefaultCommandOptions): 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.

    keyValueMap

    key-value pairs to be set

    Since

    1.0.1

    Exceptions thrown
    [[scredis.exceptions.RedisCommandException]]

    if the provided keyValueMap is empty

    Note

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

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

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

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

    Definition Classes
    AnyRef
  37. def pSetEX(key: String, value: Any, ttlMillis: Long)(implicit opts: CommandOptions = DefaultCommandOptions): 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.

  38. def set(key: String, value: Any)(implicit opts: CommandOptions = DefaultCommandOptions): Unit

    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

    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.

  39. def setBit(key: String, offset: Long, bit: Boolean)(implicit opts: CommandOptions = DefaultCommandOptions): 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.RedisCommandException]]

    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.

  40. def setEX(key: String, value: Any, ttlSeconds: Int)(implicit opts: CommandOptions = DefaultCommandOptions): 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.

  41. def setEXDuration(key: String, value: Any, ttl: FiniteDuration)(implicit opts: CommandOptions = DefaultCommandOptions): Unit

    Sets the value and expiration of a key.

    Sets the value and expiration of a key.

    key

    target key to set

    value

    value to be stored at key

    ttl

    time-to-live, up to milliseconds precision

    Since

    2.6.0

    Note

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

  42. def setNX(key: String, value: Any)(implicit opts: CommandOptions = DefaultCommandOptions): 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

  43. def setRange(key: String, offset: Long, value: Any)(implicit opts: CommandOptions = DefaultCommandOptions): 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.RedisCommandException]]

    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.

  44. def setWithOptions(key: String, value: Any, expireAfter: Option[FiniteDuration] = None, condition: Option[Condition] = None)(implicit opts: CommandOptions = DefaultCommandOptions): Boolean

    Sets the string value of a key, optionally using a condition and/or expiring it.

    Sets the string value of a key, optionally using a condition and/or expiring it.

    key

    target key to set

    value

    value to be stored at key

    expireAfter

    when defined, sets an expiration time on the value

    condition

    when defined, only set the value if the condition is verified

    returns

    true if the value was set, false if the operation was not performed because the provided condition was not met

    Since

    2.6.12

    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.

  45. def strLen(key: String)(implicit opts: CommandOptions = DefaultCommandOptions): 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.RedisCommandException]]

    if the key contains a value of the wrong type

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

    Definition Classes
    AnyRef
  47. def toString(): String

    Definition Classes
    AnyRef → Any
  48. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def substr[A](key: String, start: Long, end: Long)(implicit opts: CommandOptions = DefaultCommandOptions, parser: Parser[A] = StringParser): A

    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)

    end

    the end offset (inclusive)

    returns

    the substring determined by the specified offsets

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.1) SUBSTR has been renamed to GETRANGE in Redis versions > 2.0.0

    Since

    1.0.0

    Exceptions thrown
    [[scredis.exceptions.RedisCommandException]]

    if the value stored at key is not of type string

    Note

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

Inherited from AnyRef

Inherited from Any

Ungrouped