You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We call num.to_string().as_bytes() to serialize and deserialize numbers when setting them in memcache server. Instead, we could use byteorder crate's read_u16, read_u64 etc. and write out the bytes to the server with a specific endianness(big/little) and use the same when deserializing.
deserialization:
I have been doing some digging on this, and I am not sure if this is the best idea. Specifically because if we did use the byteorder read functions, the memcached commands incr and decr would automatically fail because the read bytes are not the string representation of the number that is being stored (Source: https://github.com/memcached/memcached/wiki/Commands#incrdecr). This is fine on the numbers that cannot be represented within a u64, but I question if it is worth this small optimization, especially because it will have different performance behaviors depending on if a number is positive or negative.
We call
num.to_string().as_bytes()
to serialize and deserialize numbers when setting them in memcache server. Instead, we could usebyteorder
crate'sread_u16
,read_u64
etc. and write out the bytes to the server with a specific endianness(big/little) and use the same when deserializing.deserialization:
rust-memcache/src/value.rs
Line 161 in faed4e1
serialization:
rust-memcache/src/value.rs
Line 95 in faed4e1
rust-memcache/src/value.rs
Line 91 in faed4e1
The text was updated successfully, but these errors were encountered: