Tag: ehcache bigmemory

多个线程可以使用相同CacheManager的相同Ehcache对象吗?

我创建了一个Cache对象,它将String作为键存储,并将序列化对象存储为值。 Cache(String—>Object) 我试图运行三个Akka线程,以同步的方式检索和写入相同的Ehcache对象。 Thread 1- synchronized (LockForEhcache){ serializedObj = cachename.get(“key”); //— this returns an Object } //modify the serializedObj here…. //Again store the modify Object in the Cache synchronized (LockForEhcache){ cachename.clear(); cachename.put(“key”,serializedObj); Thread 2- synchronized (LockForEhcache){ serializedObj = cachename.get(“key”); //— this returns null } Thread 3- synchronized (LockForEhcache){ serializedObj = cachename.get(“key”); //— this returns null […]