Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse link shared vs protected cache

The protected cache option allows for shared objects to reference isolated objects. Setting the cache isolation to PROTECTED for an entity enables its shared cache. The protected option is mostly the same as the shared option, except that protected entities can have relationships to isolated entities, where as shared can not.

what is the meaning of this exception. does this make the isolated entity shared if they have relationship with protected entity

like image 356
bob-cac Avatar asked May 02 '15 13:05

bob-cac


People also ask

What is shared cache mode?

public enum SharedCacheMode extends Enum<SharedCacheMode> Specifies how the provider must use a second-level cache for the persistence unit. Corresponds to the value of the persistence. xml shared-cache-mode element, and returned as the result of PersistenceUnitInfo. getSharedCacheMode() .

What is cache isolation?

The cache isolation level defines how caching for an entity is performed by the persistence unit and the persistence context.


2 Answers

An isolated entity is isolated, so it can never be in the shared cache. Protected vs shared only affect the entity it is applied to, and what references it is allowed to keep. References to isolated entities require special handling (and overhead) so that the isolated entities don't end up in the shared cache, hence shared entities allowing references to isolated entities were given a special designation.

like image 56
Chris Avatar answered Oct 16 '22 22:10

Chris


Protected option can be used to ensure read-only entities and queries always copy the cached objects. So you can simulate a data cache with EclipseLink. while shared ready-only will not be copied.

like image 20
Mohammed Falha Avatar answered Oct 16 '22 23:10

Mohammed Falha