Does Redis only allow string representation but not numeric value

前端 未结 2 1829
花落未央
花落未央 2021-02-19 06:26

I am getting mixed answers on my research here.

  • Can someone verify that the Redis Server can only store representation of any numerical values?

  • <
2条回答
  •  孤街浪徒
    2021-02-19 07:17

    Redis stores everything in string or in its string representation. Even functions like INCR work by first parsing it into INTEGER then performing the operation

    Note: this is a string operation because Redis does not have a dedicated integer type. The string stored at the key is interpreted as a base-10 64 bit signed integer to execute the operation.

    Redis stores integers in their integer representation, so for string values that actually hold an integer, there is no overhead for storing the string representation of the integer.

    And w.r.t Jedis; looking at the source i don't think it supports anything else other than strings

提交回复
热议问题