Redis是否只允许字符串表示而不允许数值

Does Redis only allow string representation but not numeric value

我在这里的研究得到了不同的答案。

谢谢

Redis 将所有内容存储在字符串或其字符串表示形式中。 甚至像 INCR 这样的函数也通过首先将其解析为 INTEGER 然后执行操作

来工作

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.

和w.r.t绝地武士;查看源代码,我认为它不支持除字符串以外的任何其他内容

如果您使用 JSON 编解码器,双数可以存储为字符串,但它也可以存储为 Kryo、CBOR、MsgPack 编解码器使用的二进制格式,这些编解码器受基于 Redis 的框架支持 Java - Redisson.