Back

redis - redis的数据类型 WRONGTYPE Operation against a key holding the wrong kind of value

发布时间: 2022-08-17 09:02:00

refer to: https://stackoverflow.com/questions/37953019/wrongtype-operation-against-a-key-holding-the-wrong-kind-of-value-php

Here are the commands to retrieve key value:

if value is of type string -> GET <key>
if value is of type hash -> HGETALL <key>
if value is of type lists -> lrange <key> <start> <end>
if value is of type sets -> smembers <key>
if value is of type sorted sets -> ZRANGEBYSCORE <key> <min> <max>
if value is of type stream -> xread count <count> streams <key> <ID>. https://redis.io/commands/xread

Use the TYPE command to check the type of value a key is mapping to:

type <key>

Back