Closed gitmko0 closed 3 years ago
why is there a ":" in front of the value?
The ":" indicates that the value was a Redis Integer. You used conn.WriteUint64
, which will write a Redis Integer.
it doesnt show this using the real redis server.
A real Redis server does not use integers for HSET and HGET commands. It uses strings.
I'm wondering if this is a bug with Redcon or is it possible that the PHP Redis client is expecting a string when using the ->hget()
function?
What happens when you use the redis-cli
command line tool?
but... in that case... what do u suggest for cross compatibility? how do i make it so that php redis client will return string if detection from php redis client etc?
i havent try saving a uint64 "integer" in a real redis server using go... i'm curious what's the best way forward to resolve this kind of "surprises"
what do u suggest for cross compatibility?
For your specific HGET case. I would change
conn.WriteUint64(uint64(123456789))
to
conn.WriteString(fmt.Sprintf("%d", 123456789))
i'm curious what's the best way forward to resolve this kind of "surprises"
For best cross compatibility I recommend that you make sure your Redcon commands response types match a real Redis server response types. For example, the INCR
returns an integer. So if you want to implement that command in Redcon, and you want the best compatibility across all clients, then I recommend that you return an integer.
Great work! i'm looking to replace standard php wordpress redis object cache with this if mget function is written. u are good at this. my next step is waiting for mget.
what do you suggest for mget?
let's see a pseudocode... func mget(keys {}interface) { var value []byte foreach key (keys) { append(value,append(append([]byte,key...),[]byte("\n")...)...) } return value }
can you do a PR and push this code in for mget example? thx
No. The example has enough commands to show how to use Redcon. You’ll need to implement additional commands on your own.
Tried with this code...