| 1 |
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../main/config/ehcache.xsd" name="ehcache-2-cacheManager"> |
| 2 |
|
| 3 |
<!-- Sets the path to the directory where cache .data files are created. |
| 4 |
|
| 5 |
If the path is a Java System Property it is replaced by |
| 6 |
its value in the running VM. Subdirectories can be specified below the property e.g. java.io.tmpdir/one |
| 7 |
|
| 8 |
The following properties are translated: |
| 9 |
user.home - User's home directory |
| 10 |
user.dir - User's current working directory |
| 11 |
java.io.tmpdir - Default temp file path --> |
| 12 |
<diskStore path="java.io.tmpdir/second"/> |
| 13 |
|
| 14 |
|
| 15 |
<!-- |
| 16 |
Specifies a CacheManagerEventListenerFactory which will be used to create a CacheManagerPeerProvider, which |
| 17 |
is notified when Caches are added or removed from the CacheManager. |
| 18 |
|
| 19 |
The attributes of CacheManagerEventListenerFactory are: |
| 20 |
- class - a fully qualified factory class name |
| 21 |
- properties - comma separated properties having meaning only to the factory. |
| 22 |
|
| 23 |
Sets the fully qualified class name to be registered as the CacheManager event listener. |
| 24 |
|
| 25 |
The events include: |
| 26 |
- adding a Cache |
| 27 |
- removing a Cache |
| 28 |
|
| 29 |
Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility of the implementer |
| 30 |
to safely handle the potential performance and thread safety issues depending on what their listener is doing. |
| 31 |
|
| 32 |
If no class is specified, no listener is created. There is no default. |
| 33 |
--> |
| 34 |
<!--<cacheManagerEventListenerFactory class="" properties=""/>--> |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
<!--Default Cache configuration. These will applied to caches programmatically created through |
| 39 |
the CacheManager. |
| 40 |
|
| 41 |
The following attributes are required: |
| 42 |
|
| 43 |
maxElementsInMemory - Sets the maximum number of objects that will be created in memory |
| 44 |
eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the |
| 45 |
element is never expired. |
| 46 |
overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache |
| 47 |
has reached the maxInMemory limit. |
| 48 |
|
| 49 |
The following attributes are optional: |
| 50 |
timeToIdleSeconds - Sets the time to idle for an element before it expires. |
| 51 |
i.e. The maximum amount of time between accesses before an element expires |
| 52 |
Is only used if the element is not eternal. |
| 53 |
Optional attribute. A value of 0 means that an Element can idle for infinity. |
| 54 |
The default value is 0. |
| 55 |
timeToLiveSeconds - Sets the time to live for an element before it expires. |
| 56 |
i.e. The maximum time between creation time and when an element expires. |
| 57 |
Is only used if the element is not eternal. |
| 58 |
Optional attribute. A value of 0 means that and Element can live for infinity. |
| 59 |
The default value is 0. |
| 60 |
diskPersistent - Whether the disk store persists between restarts of the Virtual Machine. |
| 61 |
The default value is false. |
| 62 |
diskExpiryThreadIntervalSeconds- The number of seconds between runs of the disk expiry thread. The default value |
| 63 |
is 120 seconds. |
| 64 |
memoryStoreEvictionPolicy - Policy would be enforced upon reaching the maxElementsInMemory limit. Default |
| 65 |
policy is Least Recently Used (specified as LRU). Other policies available - |
| 66 |
First In First Out (specified as FIFO) and Less Frequently Used |
| 67 |
(specified as LFU) |
| 68 |
cacheEventListenerClassNames - A comma separated list of CacheEventListeners. The fully qualified class name of |
| 69 |
the class which implements CacheEventListener is required. |
| 70 |
Registered listeners will be notified of cache events such as Element puts, removes and expiries |
| 71 |
and Cache status changes. The default if unspecified is an empty notifications list |
| 72 |
which does nothing. |
| 73 |
--> |
| 74 |
|
| 75 |
<defaultCache |
| 76 |
maxElementsInMemory="10" |
| 77 |
eternal="false" |
| 78 |
timeToIdleSeconds="5" |
| 79 |
timeToLiveSeconds="10" |
| 80 |
overflowToDisk="true" |
| 81 |
/> |
| 82 |
|
| 83 |
<!--Predefined caches. Add your cache configuration settings here. |
| 84 |
If you do not have a configuration for your cache a WARNING will be issued when the |
| 85 |
CacheManager starts |
| 86 |
|
| 87 |
The following attributes are required for defaultCache: |
| 88 |
|
| 89 |
name - Sets the name of the cache. This is used to identify the cache. |
| 90 |
It must be unique. |
| 91 |
maxElementsInMemory - Sets the maximum number of objects that will be created in memory |
| 92 |
eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the |
| 93 |
element is never expired. |
| 94 |
overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache |
| 95 |
has reached the maxInMemory limit. |
| 96 |
|
| 97 |
The following attributes are optional: |
| 98 |
timeToIdleSeconds - Sets the time to idle for an element before it expires. |
| 99 |
i.e. The maximum amount of time between accesses before an element expires |
| 100 |
Is only used if the element is not eternal. |
| 101 |
Optional attribute. A value of 0 means that an Element can idle for infinity. |
| 102 |
The default value is 0. |
| 103 |
timeToLiveSeconds - Sets the time to live for an element before it expires. |
| 104 |
i.e. The maximum time between creation time and when an element expires. |
| 105 |
Is only used if the element is not eternal. |
| 106 |
Optional attribute. A value of 0 means that and Element can live for infinity. |
| 107 |
The default value is 0. |
| 108 |
diskPersistent - Whether the disk store persists between restarts of the Virtual Machine. |
| 109 |
The default value is false. |
| 110 |
diskExpiryThreadIntervalSeconds- The number of seconds between runs of the disk expiry thread. The default value |
| 111 |
is 120 seconds. |
| 112 |
memoryStoreEvictionPolicy - Policy would be enforced upon reaching the maxElementsInMemory limit. Default |
| 113 |
policy is Least Recently Used (specified as LRU). Other policies available - |
| 114 |
First In First Out (specified as FIFO) and Less Frequently Used |
| 115 |
(specified as LFU) |
| 116 |
cacheEventListenerClassNames - A comma separated list of CacheEventListeners. The fully qualified class name of |
| 117 |
the class which implements CacheEventListener is required. |
| 118 |
Registered listeners will be notified of cache events such as Element puts, removes and expiries |
| 119 |
and Cache status changes. The default if unspecified is an empty notifications list |
| 120 |
which does nothing. |
| 121 |
--> |
| 122 |
<!-- Sample cache named sampleCache1 --> |
| 123 |
<cache name="sampleCache1" |
| 124 |
maxElementsInMemory="10000" |
| 125 |
eternal="false" |
| 126 |
timeToIdleSeconds="360" |
| 127 |
timeToLiveSeconds="1000" |
| 128 |
overflowToDisk="true" |
| 129 |
memoryStoreEvictionPolicy="LRU"> |
| 130 |
<cacheEventListenerFactory class="net.sf.ehcache.event.NullCacheEventListenerFactory"/> |
| 131 |
</cache> |
| 132 |
|
| 133 |
<!-- Sample cache named sampleCache2. Is eternal --> |
| 134 |
<cache name="sampleCache2" |
| 135 |
maxElementsInMemory="1000" |
| 136 |
eternal="true" |
| 137 |
overflowToDisk="false" |
| 138 |
/> |
| 139 |
|
| 140 |
<!-- Sample cache named sampleCacheNoIdle, which does not specify the optional idle time --> |
| 141 |
<cache name="sampleCacheNoIdle" |
| 142 |
maxElementsInMemory="1000" |
| 143 |
eternal="false" |
| 144 |
timeToLiveSeconds="5" |
| 145 |
overflowToDisk="false" |
| 146 |
/> |
| 147 |
|
| 148 |
<!-- Sample cache named sampleCacheNotEternalButNoIdleOrExpiry --> |
| 149 |
<cache name="sampleCacheNotEternalButNoIdleOrExpiry" |
| 150 |
maxElementsInMemory="1000" |
| 151 |
eternal="false" |
| 152 |
overflowToDisk="false" |
| 153 |
/> |
| 154 |
|
| 155 |
<!-- A cache with short idle and live expiries, suitable for tests --> |
| 156 |
<cache name="sampleIdlingExpiringCache" |
| 157 |
maxElementsInMemory="1" |
| 158 |
eternal="false" |
| 159 |
timeToIdleSeconds="2" |
| 160 |
timeToLiveSeconds="5" |
| 161 |
overflowToDisk="true" |
| 162 |
/> |
| 163 |
|
| 164 |
<!-- A cache which overflows to disk. The disk store is persistent |
| 165 |
between cache and VM restarts. The disk expiry thread interval is set to 10 minutes, overriding |
| 166 |
the default of 2 minutes. --> |
| 167 |
<cache name="persistentLongExpiryIntervalCache" |
| 168 |
maxElementsInMemory="500" |
| 169 |
eternal="false" |
| 170 |
timeToIdleSeconds="300" |
| 171 |
timeToLiveSeconds="600" |
| 172 |
overflowToDisk="true" |
| 173 |
diskPersistent="true" |
| 174 |
diskExpiryThreadIntervalSeconds="600" |
| 175 |
/> |
| 176 |
|
| 177 |
<!-- Page Caches --> |
| 178 |
|
| 179 |
<cache name="CachedLogin" |
| 180 |
maxElementsInMemory="10" |
| 181 |
eternal="false" |
| 182 |
timeToIdleSeconds="10000" |
| 183 |
timeToLiveSeconds="10000" |
| 184 |
overflowToDisk="true" |
| 185 |
/> |
| 186 |
<cache name="FooterPageCache" |
| 187 |
maxElementsInMemory="10" |
| 188 |
eternal="false" |
| 189 |
timeToIdleSeconds="10000" |
| 190 |
timeToLiveSeconds="10000" |
| 191 |
overflowToDisk="true" |
| 192 |
/> |
| 193 |
|
| 194 |
</ehcache> |