开发者

cache required serialized object

开发者 https://www.devze.com 2023-04-07 22:44 出处:网络
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) ,

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号