Decoding redis responses
Decoding redis responses
I want to decode the serialized string received on using the GET command on a bitmap or a hyperloglog. For example if a bitmap returns x80x04
on using GET
how do I change it to a representation of the offset-bit pairs in Go
x80x04
GET
I am using the go-redis API. Lets say I have added a hyperloglog to my redis database pfadd hyper 1 2 3 4
when I do a get I get the following result "HYLLx01x00x00x00x00x00x00x00x00x00x00x80Axeex84[vx80Mtx80Q,x8cCxf3"
pfadd hyper 1 2 3 4
"HYLLx01x00x00x00x00x00x00x00x00x00x00x80Axeex84[vx80Mtx80Q,x8cCxf3"
How do I change this serialized string back to the way it was when I first set the hyperloglog using pfadd
i.e. hyper 1 2 3 4
?
pfadd
hyper 1 2 3 4
@Ullaakut updated the description. Please take a look
– Palash Nigam
Aug 24 at 19:44
FYI - HLL is a lossy data structure, so you can't extract the elements in it (for the simple reason that they aren't really stored).
– Itamar Haber
Aug 24 at 19:48
Also If I can't completely retrieve an HLL then how much of it I can? Can you please explain this to me @ItamarHaber ? I couldn't find this in the docs.
– Palash Nigam
Aug 24 at 19:59
You can read about how HLL works at, for example, antirez.com/news/75
– Itamar Haber
Aug 26 at 6:43
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Please provide at least an example of code that you tried along with your question.
– Ullaakut
Aug 24 at 19:12