Serializing Data with PDX Serialization
PDX is a cross-language data format that can reduce the cost of distributing and serializing your objects. PDX stores data in named fields that you can access individually to avoid the cost of deserializing the entire data object. When you use PDX serialization with the native client C++ API, you can register a
PdxSerializer for the entire cache, implement PDX serialization for each domain object or use automatic PDX serialization by running the
You can also set the object preference of the cache to the
PdxInstance type, which allows you to access fields of a PDX object without deserializing the entire object.
When using the native client C++ API, you can opt to use PDX autoserialization. The Geode native client provides a command line tool called
pdxautoserializer that will automatically generate C++ code to PDX serialize the class you want to serialize.
For domain objects that you cannot or do not want to modify, use the
PdxWrapperclasses to serialize and deserialize the object’s fields.
Domain classes need to inherit the
PdxSerializableabstract class to serialize and de-serialize the object. When you write objects using PDX serialization, they are distributed to the server tier in PDX serialized form.
You can allow your native client C++ applications to automatically PDX serialize and deserialize domain objects without having to add any extra code by using the
pdxautoserializercommand line tool provided with the native client.
PdxInstanceis a lightweight wrapper around the raw bytes of the PDX serialized objects kept in the cache. It provides applications with run-time access to files of a PDX serialized object. Geode provides the implementation of the
setPdxIgnoreUnreadFieldsAPI to control whether PDX ignores fields that were unread during deserialization.
You can use the
PdxInstanceFactoryAPI to create a
PdxInstancefrom raw data when the domain class is not available on the server.
Because there is no “object” base type in C++, enums cannot be directly passed as parameters to the
To use delta propagation with PDX serialization, you must implement the