-
Notifications
You must be signed in to change notification settings - Fork 41
Add automatic json serialization and deserialization #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The original idea to automatically load and dump JSON/msgpack values is from the Python memcache client. The pymemcache can set a normal Python object with its set method, serialize it with Python's pickle library, and use a bit flag stored in the memcache flag to indicate it. When getting a key with such a value, pymemcache will check the flag and use pickle to deserialize the value. I haven't dug too much to see if Rust can implement this too, but I guess maybe we can try to see if we can let Serialize / Deserialize implement FromMemcacheValue / ToMemcacheValue to achieve the goal. And If we can implment this, I think we can just implment one serialization protocol like JSON, and add a hook to let user change the default behavior to change the serialization protocol and compress format. |
Looking through the code, this should be possible to implement. There is a catch though, right now we don't actually set flags for anything anywhere so we would need to add that first. This would unfortunately need changes to the arguments passed into An alternative is to allow the user to select a serialization type for the connection, and simply have everything serialized to the selected type, however this would mean the consumer wouldn't be able to use different ser/de types for different keys. What are your thoughts on this? |
I do think we should adjust the arguments for |
Sorry late for the reply. Already commented on the new issue. I think it's fine to add a mechanism to let users specify the flags. |
No description provided.
The text was updated successfully, but these errors were encountered: