source: osm/applications/editors/josm/plugins/openlayers/resources/ehcache.xml@ 24532

Last change on this file since 24532 was 12780, checked in by stoecker, 16 years ago

removed tab stop usage

File size: 18.9 KB
Line 
1<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
2
3 <!--
4 CacheManager Configuration
5 ==========================
6 An ehcache.xml corresponds to a single CacheManager.
7
8 See instructions below or the ehcache schema (ehcache.xsd) on how to configure.
9
10 DiskStore configuration
11 =======================
12
13 Sets the path to the directory where cache files are created.
14
15 If the path is a Java System Property it is replaced by its value in the
16 running VM.
17
18 The following properties are translated:
19 * user.home - User's home directory
20 * user.dir - User's current working directory
21 * java.io.tmpdir - Default temp file path
22
23 Subdirectories can be specified below the property e.g. java.io.tmpdir/one
24 -->
25 <diskStore path="java.io.tmpdir"/>
26
27 <!--
28 CacheManagerEventListener
29 =========================
30 Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
31 which is notified when Caches are added or removed from the CacheManager.
32
33 The attributes of CacheManagerEventListenerFactory are:
34 * class - a fully qualified factory class name
35 * properties - comma separated properties having meaning only to the factory.
36
37 Sets the fully qualified class name to be registered as the CacheManager event listener.
38
39 The events include:
40 * adding a Cache
41 * removing a Cache
42
43 Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
44 of the implementer to safely handle the potential performance and thread safety issues
45 depending on what their listener is doing.
46
47 If no class is specified, no listener is created. There is no default.
48 -->
49 <cacheManagerEventListenerFactory class="" properties=""/>
50
51
52 <!--
53 CacheManagerPeerProvider
54 ========================
55 (Enable for distributed operation)
56
57 Specifies a CacheManagerPeerProviderFactory which will be used to create a
58 CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
59
60 The attributes of cacheManagerPeerProviderFactory are:
61 * class - a fully qualified factory class name
62 * properties - comma separated properties having meaning only to the factory.
63
64 Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
65 CacheManager peers participating in the cluster:
66 * automatic, using a multicast group. This one automatically discovers peers and detects
67 changes such as peers entering and leaving the group
68 * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
69 configuration time.
70
71 Configuring Automatic Discovery:
72 Automatic discovery is configured as per the following example:
73 <cacheManagerPeerProviderFactory
74 class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
75 properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
76 multicastGroupPort=4446, timeToLive=32"/>
77
78 Valid properties are:
79 * peerDiscovery (mandatory) - specify "automatic"
80 * multicastGroupAddress (mandatory) - specify a valid multicast group address
81 * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
82 traffic
83 * timeToLive - specify a value between 0 and 255 which determines how far the packets will
84 propagate.
85
86 By convention, the restrictions are:
87 0 - the same host
88 1 - the same subnet
89 32 - the same site
90 64 - the same region
91 128 - the same continent
92 255 - unrestricted
93
94 Configuring Manual Discovery:
95 Manual discovery is configured as per the following example:
96 <cacheManagerPeerProviderFactory class=
97 "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
98 properties="peerDiscovery=manual,
99 rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
100 | //server1:40000/sampleCache2|//server2:40000/sampleCache2"
101 propertySeparator="," />
102
103 Valid properties are:
104 * peerDiscovery (mandatory) - specify "manual"
105 * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
106 //hostname:port
107
108 The hostname is the hostname of the remote CacheManager peer. The port is the listening
109 port of the RMICacheManagerPeerListener of the remote CacheManager peer.
110
111 -->
112 <cacheManagerPeerProviderFactory
113 class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
114 properties="peerDiscovery=automatic,
115 multicastGroupAddress=230.0.0.1,
116 multicastGroupPort=4446, timeToLive=1"
117 propertySeparator=","
118 />
119
120
121 <!--
122 CacheManagerPeerListener
123 ========================
124 (Enable for distributed operation)
125
126 Specifies a CacheManagerPeerListenerFactory which will be used to create a
127 CacheManagerPeerListener, which
128 listens for messages from cache replicators participating in the cluster.
129
130 The attributes of cacheManagerPeerListenerFactory are:
131 class - a fully qualified factory class name
132 properties - comma separated properties having meaning only to the factory.
133
134 Ehcache comes with a built-in RMI-based distribution system. The listener component is
135 RMICacheManagerPeerListener which is configured using
136 RMICacheManagerPeerListenerFactory. It is configured as per the following example:
137
138 <cacheManagerPeerListenerFactory
139 class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
140 properties="hostName=fully_qualified_hostname_or_ip,
141 port=40001,
142 socketTimeoutMillis=120000"
143 propertySeparator="," />
144
145 All properties are optional. They are:
146 * hostName - the hostName of the host the listener is running on. Specify
147 where the host is multihomed and you want to control the interface over which cluster
148 messages are received. Defaults to the host name of the default interface if not
149 specified.
150 * port - the port the listener listens on. This defaults to a free port if not specified.
151 * socketTimeoutMillis - the number of ms client sockets will stay open when sending
152 messages to the listener. This should be long enough for the slowest message.
153 If not specified it defaults 120000ms.
154
155 -->
156 <cacheManagerPeerListenerFactory
157 class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/>
158
159
160 <!--
161 Cache configuration
162 ===================
163
164 The following attributes are required.
165
166 name:
167 Sets the name of the cache. This is used to identify the cache. It must be unique.
168
169 maxElementsInMemory:
170 Sets the maximum number of objects that will be created in memory
171
172 maxElementsOnDisk:
173 Sets the maximum number of objects that will be maintained in the DiskStore
174 The default value is zero, meaning unlimited.
175
176 eternal:
177 Sets whether elements are eternal. If eternal, timeouts are ignored and the
178 element is never expired.
179
180 overflowToDisk:
181 Sets whether elements can overflow to disk when the memory store
182 has reached the maxInMemory limit.
183
184 The following attributes and elements are optional.
185
186 timeToIdleSeconds:
187 Sets the time to idle for an element before it expires.
188 i.e. The maximum amount of time between accesses before an element expires
189 Is only used if the element is not eternal.
190 Optional attribute. A value of 0 means that an Element can idle for infinity.
191 The default value is 0.
192
193 timeToLiveSeconds:
194 Sets the time to live for an element before it expires.
195 i.e. The maximum time between creation time and when an element expires.
196 Is only used if the element is not eternal.
197 Optional attribute. A value of 0 means that and Element can live for infinity.
198 The default value is 0.
199
200 diskPersistent:
201 Whether the disk store persists between restarts of the Virtual Machine.
202 The default value is false.
203
204 diskExpiryThreadIntervalSeconds:
205 The number of seconds between runs of the disk expiry thread. The default value
206 is 120 seconds.
207
208 diskSpoolBufferSizeMB:
209 This is the size to allocate the DiskStore for a spool buffer. Writes are made
210 to this area and then asynchronously written to disk. The default size is 30MB.
211 Each spool buffer is used only by its cache. If you get OutOfMemory errors consider
212 lowering this value. To improve DiskStore performance consider increasing it. Trace level
213 logging in the DiskStore will show if put back ups are occurring.
214
215 memoryStoreEvictionPolicy:
216 Policy would be enforced upon reaching the maxElementsInMemory limit. Default
217 policy is Least Recently Used (specified as LRU). Other policies available -
218 First In First Out (specified as FIFO) and Less Frequently Used
219 (specified as LFU)
220
221 Cache elements can also contain sub elements which take the same format of a factory class
222 and properties. Defined sub-elements are:
223
224 * cacheEventListenerFactory - Enables registration of listeners for cache events, such as
225 put, remove, update, and expire.
226
227 * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a
228 cache on initialisation to prepopulate itself.
229
230 * cacheExtensionFactory - Specifies a CacheExtension, a generic mechansim to tie a class
231 which holds a reference to a cache to the cache lifecycle.
232
233 * cacheExceptionHandlerFactory - Specifies a CacheExceptionHandler, which is called when
234 cache exceptions occur.
235
236 * cacheLoaderFactory - Specifies a CacheLoader, which can be used both asynchronously and
237 synchronously to load objects into a cache.
238
239 RMI Cache Replication
240
241 Each cache that will be distributed needs to set a cache event listener which replicates
242 messages to the other CacheManager peers. For the built-in RMI implementation this is done
243 by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
244 distributed cache's configuration as per the following example:
245
246 <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
247 properties="replicateAsynchronously=true,
248 replicatePuts=true,
249 replicateUpdates=true,
250 replicateUpdatesViaCopy=true,
251 replicateRemovals=true
252 asynchronousReplicationIntervalMillis=<number of milliseconds"
253 propertySeparator="," />
254
255 The RMICacheReplicatorFactory recognises the following properties:
256
257 * replicatePuts=true|false - whether new elements placed in a cache are
258 replicated to others. Defaults to true.
259
260 * replicateUpdates=true|false - whether new elements which override an
261 element already existing with the same key are replicated. Defaults to true.
262
263 * replicateRemovals=true - whether element removals are replicated. Defaults to true.
264
265 * replicateAsynchronously=true | false - whether replications are
266 asynchronous (true) or synchronous (false). Defaults to true.
267
268 * replicateUpdatesViaCopy=true | false - whether the new elements are
269 copied to other caches (true), or whether a remove message is sent. Defaults to true.
270
271 * asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
272 replicator runs at a set interval of milliseconds. The default is 1000. The minimum
273 is 10. This property is only applicable if replicateAsynchronously=true
274
275
276 Cluster Bootstrapping
277
278 The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are
279 used. It is configured as per the following example:
280
281 <bootstrapCacheLoaderFactory
282 class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
283 properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"
284 propertySeparator="," />
285
286 The RMIBootstrapCacheLoaderFactory recognises the following optional properties:
287
288 * bootstrapAsynchronously=true|false - whether the bootstrap happens in the background
289 after the cache has started. If false, bootstrapping must complete before the cache is
290 made available. The default value is true.
291
292 * maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the
293 memory limits of the VM. This property allows the bootstraper to fetched elements in
294 chunks. The default chunk size is 5000000 (5MB).
295
296
297 Cache Exception Handling
298
299 By default, most cache operations will propagate a runtime CacheException on failure. An
300 interceptor, using a dynamic proxy, may be configured so that a CacheExceptionHandler can
301 be configured to intercept Exceptions. Errors are not intercepted.
302
303 It is configured as per the following example:
304
305 <cacheExceptionHandlerFactory class="com.example.ExampleExceptionHandlerFactory"
306 properties="logLevel=FINE"/>
307
308 Caches with ExceptionHandling configured are not of type Cache, but are of type Ehcache only,
309 and are not available using CacheManager.getCache(), but using CacheManager.getEhcache().
310
311
312 Cache Loader
313
314 A default CacheLoader may be set which loads objects into the cache through asynchronous and
315 synchronous methods on Cache. This is different to the bootstrap cache loader, which is used
316 only in distributed caching.
317
318 It is configured as per the following example:
319
320 <cacheLoaderFactory class="com.example.ExampleCacheLoaderFactory"
321 properties="type=int,startCounter=10"/>
322
323 Cache Extension
324
325 CacheExtensions are a general purpose mechanism to allow generic extensions to a Cache.
326 CacheExtensions are tied into the Cache lifecycle.
327
328 CacheExtensions are created using the CacheExtensionFactory which has a
329 <code>createCacheCacheExtension()</code> method which takes as a parameter a
330 Cache and properties. It can thus call back into any public method on Cache, including, of
331 course, the load methods.
332
333 Extensions are added as per the following example:
334
335 <cacheExtensionFactory class="com.example.FileWatchingCacheRefresherExtensionFactory"
336 properties="refreshIntervalMillis=18000, loaderTimeout=3000,
337 flushPeriod=whatever, someOtherProperty=someValue ..."/>
338
339 -->
340
341
342 <!--
343 Mandatory Default Cache configuration. These settings will be applied to caches
344 created programmtically using CacheManager.add(String cacheName).
345
346 The defaultCache has an implicit name "default" which is a reserved cache name.
347 -->
348 <defaultCache
349 maxElementsInMemory="10000"
350 eternal="false"
351 timeToIdleSeconds="120"
352 timeToLiveSeconds="120"
353 overflowToDisk="true"
354 diskSpoolBufferSizeMB="30"
355 maxElementsOnDisk="10000000"
356 diskPersistent="false"
357 diskExpiryThreadIntervalSeconds="120"
358 memoryStoreEvictionPolicy="LRU"
359 />
360
361 <!--
362 Sample caches. Following are some example caches. Remove these before use.
363 -->
364
365 <!--
366 Sample cache named sampleCache1
367 This cache contains a maximum in memory of 10000 elements, and will expire
368 an element if it is idle for more than 5 minutes and lives for more than
369 10 minutes.
370
371 If there are more than 10000 elements it will overflow to the
372 disk cache, which in this configuration will go to wherever java.io.tmp is
373 defined on your system. On a standard Linux system this will be /tmp"
374 -->
375 <cache name="sampleCache1"
376 maxElementsInMemory="10000"
377 maxElementsOnDisk="1000"
378 eternal="false"
379 overflowToDisk="true"
380 diskSpoolBufferSizeMB="20"
381 timeToIdleSeconds="300"
382 timeToLiveSeconds="600"
383 memoryStoreEvictionPolicy="LFU"
384 />
385
386
387 <!--
388 Sample cache named sampleCache2
389 This cache has a maximum of 1000 elements in memory. There is no overflow to disk, so 1000
390 is also the maximum cache size. Note that when a cache is eternal, timeToLive and
391 timeToIdle are not used and do not need to be specified.
392 -->
393 <cache name="sampleCache2"
394 maxElementsInMemory="1000"
395 eternal="true"
396 overflowToDisk="false"
397 memoryStoreEvictionPolicy="FIFO"
398 />
399
400
401 <!--
402 Sample cache named sampleCache3. This cache overflows to disk. The disk store is
403 persistent between cache and VM restarts. The disk expiry thread interval is set to 10
404 minutes, overriding the default of 2 minutes.
405 -->
406 <cache name="sampleCache3"
407 maxElementsInMemory="500"
408 eternal="false"
409 overflowToDisk="true"
410 timeToIdleSeconds="300"
411 timeToLiveSeconds="600"
412 diskPersistent="true"
413 diskExpiryThreadIntervalSeconds="1"
414 memoryStoreEvictionPolicy="LFU"
415 />
416
417
418 <!--
419 Sample distributed cache named sampleDistributedCache1.
420 This cache replicates using defaults.
421 It also bootstraps from the cluster, using default properties.
422 -->
423 <cache name="sampleDistributedCache1"
424 maxElementsInMemory="10"
425 eternal="false"
426 timeToIdleSeconds="100"
427 timeToLiveSeconds="100"
428 overflowToDisk="false">
429 <cacheEventListenerFactory
430 class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
431 <bootstrapCacheLoaderFactory
432 class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
433 </cache>
434
435
436 <!--
437 Sample distributed cache named sampleDistributedCache2.
438 This cache replicates using specific properties.
439 It only replicates updates and does so synchronously via copy
440 -->
441 <cache name="sampleDistributedCache2"
442 maxElementsInMemory="10"
443 eternal="false"
444 timeToIdleSeconds="100"
445 timeToLiveSeconds="100"
446 overflowToDisk="false">
447 <cacheEventListenerFactory
448 class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
449 properties="replicateAsynchronously=false, replicatePuts=false,
450 replicateUpdates=true, replicateUpdatesViaCopy=true,
451 replicateRemovals=false"/>
452 </cache>
453
454 <!--
455 Sample distributed cache named sampleDistributedCache3.
456 This cache replicates using defaults except that the asynchronous replication
457 interval is set to 200ms.
458 -->
459 <cache name="sampleDistributedCache3"
460 maxElementsInMemory="10"
461 eternal="false"
462 timeToIdleSeconds="100"
463 timeToLiveSeconds="100"
464 overflowToDisk="false">
465 <cacheEventListenerFactory
466 class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
467 properties="asynchronousReplicationIntervalMillis=200"/>
468 </cache>
469
470
471
472
473</ehcache>
Note: See TracBrowser for help on using the repository browser.