Caching

This table lists the properties of the Caching page of the persistence.xml Editor.

Property Description Default

Shared cache mode

Select one of the following as the shared cache mode:

  • All – .

  • None

  • Enable Selective

  • Disable Selective

  • Unspecified

Disable selective

Default Cache Type

Select one of the following as the Default Cache Type:

  • Weak with Soft Subcache–This option is similar to Weak with Hard Subcache except that it maintains a most frequently used subcache that uses soft references. The size of the subcache is proportional to the size of the identity map. The subcache uses soft references to ensure that these objects are garbage-collected only if the system is low on memory.

    Use this identity map in most circumstances as a means to control memory used by the cache.

  • Weak with Hard Subcache–This option is similar to Soft with Weak subcache except that it maintains a most frequently used subcache that uses hard references. Use this identity map if soft references are not suitable for your platform.

  • Weak–This option is similar to Full, except that objects are referenced using weak references. This option uses less memory than Full, allows complete garbage collection and provides full caching and guaranteed identity.

    Use this identity map for transactions that, once started, stay on the server side.

  • Soft–This option is similar to Weak except that the map holds the objects using soft references. This identity map enables full garbage collection when memory is low. It provides full caching and guaranteed identity.

  • Full–This option provides full caching and guaranteed identity: all objects are cached and not removed.

    Note: This process may be memory-intensive when many objects are read.

  • None–This option does not preserve object identity and does not cache objects.This option is not recommended.

Weak with soft subcache

Default Cache Size

Set the size (maximum number of objects) of the cache.

100

Flush clear cache

Select one of the following as the Default Cache Type:

  • Drop – This mode is the fastest and uses the least memory. However, after commit the shared cache might potentially contain stale data.

  • Drop Invalidate – Classes that have at least one object updated or deleted are invalidated in the shared cache at commit time. This mode is slower than Drop, but as efficient memory usage-wise, and prevents stale data.

  • Merge – Drop classes from the EntityManager's cache of objects that have not been flushed. This mode leaves the shared cache in a perfect state after commit. However, it is the least memory-efficient mode; the memory might even run out in a very large transaction.

Drop Invalidate



Note:

This page is not available for projects using the Generic platform.


Related references