简体   繁体   English

如何在 go redis 客户端中使用 igbinary 序列化 GET 和 SET

[英]How to serialize GET and SET using igbinary inside go redis client

I have a php service and a golang service.我有一个 php 服务和一个 golang 服务。 I set the value of redis in the php service and use igbinary.我在 php 服务中设置了 redis 的值,并使用了 igbinary。 How to correctly GET this value in golang service.如何在 golang 服务中正确获取此值。

igbinary of php sets a binary value, you can read the binary value into array of []byte in go. igbinary的 igbinary 设置一个二进制值,您可以将二进制值读入 go 中的[]byte数组。

response,err:=redisClient.Get(ctx,"key").Bytes()

here response bytes can be unmarshalled into proper struct to get values.这里可以将响应字节解组为适当的结构以获取值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM