Cache serialization mode
0 | Binary |
Binary serialization using the native framework serialization capability. This mode is the fastest but is not backward compatible between different versions of LEADTOOLS. This mode will create a cache that cannot be shared between the .NET and Java version of Leadtools.Caching. |
1 | Xml |
XML serialization. This mode is backward compatible between different versions of LEADTOOLS. This mode will create a cache that can be shared between the .NET and Java version of Leadtools.Caching. |
2 | Json |
Json serialization. This mode is backward compatible between different versions of LEADTOOLS. This mode will create a cache that can be shared between the .NET and Java version of Leadtools.Caching. Recommended. |
CacheSerializationMode is used as the type for the following members:
Member | Description |
---|---|
ObjectCache.PolicySerializationMode |
Determines the type of serialization to use when the policy is saved into the cache. |
ObjectCache.DataSerializationMode |
Determines the type of serialization to use when the data is saved into the cache. |
The LEADTOOLS Document Viewer and Converter framework uses the recommended CacheSerializationMode.Json mode that offers backward compatibility as well as sharing a cache between the .NET and Java version of the framework.
When Binary is used, the cache will use the default framework binary serializer to save and load the policy file or data items. For instance, by using the System.Runtime.Serialization.Formatters.Binary.BinaryFormatter in the .NET framework. The cache will contain an [item].data and [item].policy files containing a binary stream of the item value binary data and its policy.
When Xml is used, the cache will create an XML serializer to save and load the policy file or data items. For instance, by using the System.Runtime.Serialization.DataContractSerializer in the .NET framework. The cache will contain an [item].data and [item].policy.xml files containing the xml representation of the item value type and its policy. When using this mode, it is your responsibility to ensure that the complex item values contain types that contains the .NET DataContract / DataMember attributes. This mode is not supported by the Java framework.
When Json is used, the cache will create a JSON serializer to save and load the policy file or data items. For instance, by using the System.Runtime.Serialization.Json.DataContractJsonSerializer in the .NET framework. The cache will contain an [item].data and [item].policy.json files containing the xml representation of the item value type and its policy. When using this mode, it is your responsibility to ensure that the complex item values contain types that contains the .NET DataContract / DataMember attributes. This mode is not supported by the Java framework (using the gson library).