سؤال

I've encountered some code that is using Spring ehcache. The objects that are being cached do not implement the serializable interface.

class MyObj(){

}

List<MyObj> = new ArrayList<MyObj>

So even though ArrayList implements serializable should'nt MyObj also implement serializable for ehcache to work correctly ?

هل كانت مفيدة؟

المحلول

Objects used in Ehcache only need to implement Serializable if you need to store the cache on disk or are using cache replication.

Check out the section

Supports Object or Serializable caching

from this documentation

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top