Why are the values added by redis zadd serialized

getting it through php code will always be serialized

127.0.0.1:6379> ZRANGE key  0 -1 WITHSCORES
1) "i:1;"
2) "1"
3) "s:6:\"google\";"
4) "1"
5) "i:4;"
6) "2"
7) "s:4:\"i:1;\";"
8) "2"
127.0.0.1:6379> ZRANGE key  0 -1 WITHSCORES

but I can add normal directly under cli. Why is that?

127.0.0.1:6379> zadd key 1 google
(integer) 1
127.0.0.1:6379> ZRANGE key  0 -1 WITHSCORES
 1) "google"
 2) "1"
 3) "i:1;"
 4) "1"
 5) "s:6:\"google\";"
 6) "1"
 7) "i:4;"
 8) "2"
 9) "s:4:\"i:1;\";"
10) "2"
127.0.0.1:6379> 
May.09,2022

because redis kv mode can only store strings, how does the array of PHP become strings? the default is serialization, and deserialization
when fetching. In most cases, we manually convert JSON strings into redis, so it is more convenient for other programs to read.

= Update =

The serialization parameter of the

phpredis extension has three values, which are

$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);    // don't serialize data
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);    // use built-in serialize/unserialize
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);    // use igBinary serialize/unserialize

use $redis- > getOption (Redis::OPT_SERIALIZER); method to see which one is configured


found the problem, which solves the problem of turning off serialization

$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);   // don't serialize data

$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);    // use built-in serialize/unserialize

$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);   // use igBinary serialize/unserialize

$redis->setOption(Redis::OPT_PREFIX, 'myAppName:'); // use custom prefix on all keys
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c26f4e-32fb1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c26f4e-32fb1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?