The ehcache configuration parameters

Recommended for you: Get network issues from WhatsUp Gold. Not end users.
The Cache configuration


The following is a must
Unique identifier name name:Cache
Sets the name of the cache. This is used to identify the cache. It must be unique.


MaxEntriesLocalHeap: pile maximum cache object in memory, 0 no limit
Sets the maximum number of objects that will be held on heap memory. 0 = no limit.


Maximum number of objects of the maxEntriesLocalDisk: disk, the default is 0 does not limit
Sets the maximum number of objects that will be maintained in the DiskStore
The default value is zero, meaning unlimited.


Whether the eternal:elements is permanently valid, if true, timeouts will be ignored, element will never expire
Sets whether elements are eternal. If eternal, timeouts are ignored and the
element is never expired.


The following attributes and elements are optional.
The following properties are optional


MaxEntriesInCache: can only be used in the Terracotta distributed caches
This feature is applicable only to Terracotta distributed caches.
Sets the maximum number of entries that can be stored in the cluster. 0 = no limit.
Note that clustered cache will still perform eviction if resource usage requires it.
This property can be modified dynamically while the cache is operating.


OverflowToOffHeap: can only be used for the enterprise version
(boolean) This feature is available only in enterprise versions of Ehcache.
When set to true, enables the cache to utilize off-heap memory
storage to improve performance. Off-heap memory is not subject to Java
GC. The default value is false.2


If this property is set to maxBytesLocalHeap:, maxEntriesLocalHeap will not be used
Defines how many bytes the cache may use from the VM's heap. If a CacheManager
maxBytesLocalHeap has been defined, this Cache's specified amount will be
subtracted from the CacheManager. Other caches will share the remainder.
This attribute's values are given as <number>k|K|m|M|g|G for
kilobytes (k|K), megabytes (m|M), or gigabytes (g|G).
For example, maxBytesLocalHeap="2g" allots 2 gigabytes of heap memory.
If you specify a maxBytesLocalHeap, you can't use the maxEntriesLocalHeap attribute.
maxEntriesLocalHeap can't be used if a CacheManager maxBytesLocalHeap is set.


Elements put into the cache will be measured in size using net.sf.ehcache.pool.sizeof.SizeOf
If you wish to ignore some part of the object graph, see net.sf.ehcache.pool.sizeof.annotations.IgnoreSizeOf


MaxBytesLocalOffHeap: can only be used for the enterprise version
This feature is available only in enterprise versions of Ehcache.
Sets the amount of off-heap memory this cache can use, and will reserve.


This setting will set overflowToOffHeap to true. Set explicitly to false to disable overflow behavior.


Note that it is recommended to set maxEntriesLocalHeap to at least 100 elements
when using an off-heap store, otherwise performance will be seriously degraded,
and a warning will be logged.


The minimum amount that can be allocated is 128MB. There is no maximum.


MaxBytesLocalDisk: like the maxBytesLocalHeap attribute
As for maxBytesLocalHeap, but specifies the limit of disk storage this cache will ever use.


Idle seconds before failure number timeToIdleSeconds:, when eternal is false, this property is valid, 0 unlimited
Sets the time to idle for an element before it expires.
i.e. The maximum amount of time between accesses before an element expires
Is only used if the element is not eternal.
Optional attribute. A value of 0 means that an Element can idle for infinity.
The default value is 0.


Survival second timeToLiveSeconds: prior to the failure number, create time to failure time interval for the survival time, when eternal is false, this property is valid, 0 unlimited
Sets the time to live for an element before it expires.
i.e. The maximum time between creation time and when an element expires.
Is only used if the element is not eternal.
Optional attribute. A value of 0 means that and Element can live for infinity.
The default value is 0.


diskExpiryThreadIntervalSeconds:
The number of seconds between runs of the disk expiry thread. The default value
is 120 seconds.


The diskSpoolBufferSizeMB: parameter set DiskStore (disk cache) cache size. The default is 30MB. Each Cache should have a its own buffer.
This is the size to allocate the DiskStore for a spool buffer. Writes are made
to this area and then asynchronously written to disk. The default size is 30MB.
Each spool buffer is used only by its cache. If you get OutOfMemory errors consider
lowering this value. To improve DiskStore performance consider increasing it. Trace level
logging in the DiskStore will show if put back ups are occurring.


ClearOnFlush: when calling flush () whether to clear the cache, the default is
whether the MemoryStore should be cleared when flush() is called on the cache.
By default, this is true i.e. the MemoryStore is cleared.


MemoryStoreEvictionPolicy: memory recovery strategy, the default recovery strategy: the least recently used Least Recently Used First In First, first in first out Out, Less Frequently Used to use the lowest frequency
Policy would be enforced upon reaching the maxEntriesLocalHeap limit. Default
policy is Least Recently Used (specified as LRU). Other policies available -
First In First Out (specified as FIFO) and Less Frequently Used
(specified as LFU)


copyOnRead:
Whether an Element is copied when being read from a cache.
By default this is false.


copyOnWrite:
Whether an Element is copied when being added to the cache.
By default this is false.


Cache persistence is configured through the persistence sub-element. The attributes of the
persistence element are:


strategy:
Configures the type of persistence provided by the configured cache. This must be one of the
following values:


* localRestartable - Enables the RestartStore and copies all cache entries (on-heap and/or off-heap)
to disk. This option provides fast restartability with fault tolerant cache persistence on disk.
It is available for Enterprise Ehcache users only.


* localTempSwap - Swaps cache entries (on-heap and/or off-heap) to disk when the cache is full.
"localTempSwap" is not persistent.


* none - Does not persist cache entries.


* distributed - Defers to the <terracotta> configuration for persistence settings. This option
is not applicable for standalone.

synchronousWrites:
When set to true write operations on the cache do not return until after the operations data has been
successfully flushed to the disk storage. This option is only valid when used with the "localRestartable"
strategy, and defaults to false.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Nikita at March 09, 2014 - 11:47 AM