Reputation: 18347
I'm using Tangosol Coherence v3.2.2b371. Can I cache objects that do not implement Serializable through the NamedCache api? Or this depends on configuration?
Edit: For clarification, I'm trying to cache compiled javax.xml.xpath.XPathExpression objects.
Upvotes: 4
Views: 2567
Reputation: 6317
To store an object in the cache it must be serializable but does not have to implement Serializable. Specifically, it can use POF which is more efficient in time and memory than Serializable.
POF does require some additional configuration, which is described in the article I linked to.
Upvotes: 3
Reputation: 1236
It depends on configuration. If you need to store objects that don't support serialization, you need to have a com.tangosol.io.Serializer implementation that can do the serialization on behalf of the non-serializable objects. You may find that for common cases, this is already supported by e.g. a PofSerializer.
Upvotes: 1
Reputation: 11
Coherence can cache non-Serializable but POF-aware (either PortableObject or one having a registered PofSerializer) objects starting with 3.4.
Before that POF (or any other custom Serializer for that matter) was not usable as a storage (within the backing map) and tranport format within the cluster (on the TCMP protocol), it was only used as a transport protocol in TCP*Extend.
Upvotes: 1
Reputation: 10101
I'm guessing (just guessing) that the answer is "no". However, do take a look at the PortableObject interface. This is supposed to be an alternative to java.io.Serializable, but for performance reasons. You should check whether it can be used to replace Serializable interface.
Upvotes: 1