이 콘텐츠는 선택한 언어로 제공되지 않습니다.
2.3. Using Eviction
eviction
/> element is used to enable eviction without any strategy or maximum entries settings, the following default values are used:
- Strategy: If no eviction strategy is specified,
EvictionStrategy.NONE
is assumed as a default. - size: If no value is specified, the
size
value is set to-1
, which allows unlimited entries.
2.3.1. Initialize Eviction 링크 복사링크가 클립보드에 복사되었습니다!
size
attributes value to a number greater than zero. Adjust the value set for size
to discover the optimal value for your configuration. It is important to remember that if too large a value is set for size
, Red Hat JBoss Data Grid runs out of memory.
Procedure 2.1. Initialize Eviction
Add the Eviction Tag
Add the <eviction> tag to your project's <cache> tags as follows:<eviction />
<eviction />
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the Eviction Strategy
Set thestrategy
value to set the eviction strategy employed. Possible values areLRU
,UNORDERED
andLIRS
(orNONE
if no eviction is required). The following is an example of this step:<eviction strategy="LRU" />
<eviction strategy="LRU" />
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the Maximum Size to use for Eviction
Set the maximum number of entries allowed in memory by defining thesize
element. The default value is-1
for unlimited entries. The following demonstrates this step:<eviction strategy="LRU" size="200" />
<eviction strategy="LRU" size="200" />
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Eviction is configured for the target cache.
2.3.2. Eviction Configuration Examples 링크 복사링크가 클립보드에 복사되었습니다!
<eviction strategy="LRU" size="2000"/>
<eviction strategy="LRU" size="2000"/>
2.3.3. Utilizing Memory Based Eviction 링크 복사링크가 클립보드에 복사되었습니다!
Only keys and values that are stored as primitives, primitive wrappers (such as java.lang.Integer
), java.lang.String
instances, or an Array
of these values may be used with memory based eviction.
store-as-binary
must be enabled on the cache, or the data from the custom class may be serialized, storing it in a byte array.
Memory based eviction is only supported with the LRU
eviction strategy.
This eviction method may be used by defining MEMORY
as the eviction type, as seen in the following example:
<local-cache name="local"> <eviction size="10000000000" strategy="LRU" type="MEMORY"/> </local-cache>
<local-cache name="local">
<eviction size="10000000000" strategy="LRU" type="MEMORY"/>
</local-cache>