cometta
cometta

Reputation: 35679

cache required serialized object

I try to store (List-> with many pojo objects) into memcache. the requirement is the value(object) need to implements serializable. is there any technique to use memcache.put(value) , without required to implement serializable for (List-> with many pojo objects) ?

will java outputList= Collection.singletonList(inputList); memcache(key, outputList); will this work?

Upvotes: 0

Views: 1262

Answers (1)

Pintobean77
Pintobean77

Reputation: 1415

No, I do not think it will. The List collection knows how to serialize itself, but not how to serialize the objects it contains. Thus, the job of serialization falls on to the individual objects, and rightfully so since the object is really the only thing that can know its full state.

Implementing Serializable is pretty trivial, unless there are some unstated circumstances?

Upvotes: 1

Related Questions