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.pu开发者_如何转开发t(value) , without required to implement serializable for (List-> with many pojo objects) ?
will java outputList= Collection.singletonList(inputList); memcache(key, outputList);
will this work?
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?
精彩评论