Redis is binary safe since its first apparence in the world :)
Salvatore
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to
> redis-db+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/redis-db?hl=en.
>
--
Salvatore 'antirez' Sanfilippo
open source developer - VMware
http://invece.org
"We are what we repeatedly do. Excellence, therefore, is not an act,
but a habit." -- Aristotele
Wilton <risen...@gmail.com> a écrit :
I haven't touched Java for a long time, but in other languages I use MessagePack to encode the object into String format, so I guess you could do the same. It adds headers (1 byte for simple types) that make it able to retrieve the type of the object when decoding, you can strip them to save memory if you don't need them.
--
Pierre 'catwell' Chapuis
Jonathan
--
In such a case I would convert this special NaN values into strings, like
"+inf", "-inf", and so forth.
Then handle them specially when reading back.
Storing floats as binary values is surely ok as Redis does not care
too much, but a bit strange mode of operation given that numbers are
easy to serialize in a human readable way.
Cheers,
Salvatore
>
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to
> redis-db+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/redis-db?hl=en.
>
--
On Thu, Mar 10, 2011 at 12:12 AM, Wilton <risen...@gmail.com> wrote:
>
> I tried this all day yesterday but ran into problems with my Doubles that
> are NaN (such as POSITIVE_INFINITY). I might have been doing something
> wrong, but when I tried to read it from Redis using parseDouble, they didn't
> turn back into the original values.In such a case I would convert this special NaN values into strings, like
"+inf", "-inf", and so forth.Then handle them specially when reading back.
I understand your point, however I'm really not qualified to comment
this as I don't know Java.
Redis is often used in the domain of more dynamic languages, where the
serialization is more or less a non issue. For this languages a simple
API is a win, as serialization is really trivial or not needed at all
in most cases.
For instance the Ruby driver by default calls toe "to_s" method
against what you pass to Redis, to convert it into a string.
Everything is a string, basically, unless you use this string in some
special way like passing a serialized object, but this is not a common
pattern.
In Java this may be different, I'm not sure. What I noticed with
interest is that in Java there is usually a big amount of disagreement
about what a good API is. I guess there are many different
philosophies in the users of the language.
Cheers,
Salvatore