mumoshu / play2-memcached

A memcached plugin for Play 2.x
Other
161 stars 66 forks source link

Use of java for serialization does not directly replace ehcache #21

Open nsiemens opened 11 years ago

nsiemens commented 11 years ago

You are using Java to do the object serialization. This turns into a gotcha because the default play2 cache doesn't, and therefore is able to serialize classes that don't implement Serializable. Which causes fireworks when your plugin replaces the default and everything that caches a non-implementer of Serializable breaks because of the additional requirement that your plugin is placing on input to the Cache.

mumoshu commented 11 years ago

@nsiemens

Thanks for the info! I think I have missed about that until now. Would you mind providing me where I can see Ehcache's object serialization algorithm?

mwy001 commented 11 years ago

This is an issue if you want to cache the play.mvc.Result instances. The default Ehcache can do so while play2-memcached cannot.

mumoshu commented 11 years ago

Thanks for your feedback, @nsiemens @mwy001 !

I'll write specs for play.mvc.Result chaching and tackle it with twitter's chill. Further feedbacks and pull requests are always welcome!

mumoshu commented 10 years ago

Scala Pickling looks promising but for now it doen't allow serializing/deserializing Any or AnyRefs.

mkubala commented 10 years ago

@mumoshu maybe instead of looking for silver bullet which will cover all cases, it will be better to give some basic serializer and allow users to plug-in they own serializers, like the akka's serialization do?

This way we will give control (and responsibility) over performance, backward compability, fields ommiting etc. to the end user.

mkurz commented 7 years ago

If you want to cache a Result just use SerializableResult: https://github.com/playframework/playframework/blob/2.6.1/framework/src/play-cache/src/main/scala/play/api/cache/Cached.scala#L189