-
Notifications
You must be signed in to change notification settings - Fork 589
Expand file tree
/
Copy pathehcache-example.xml
More file actions
114 lines (101 loc) · 3.69 KB
/
ehcache-example.xml
File metadata and controls
114 lines (101 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<ehcache:config
xmlns:ehcache="http://www.ehcache.org/v3"
xmlns:jcache="http://www.ehcache.org/v3/jsr107">
<!--
OPTIONAL
services to be managed and lifecycled by the CacheManager
-->
<ehcache:service>
<!--
One element in another namespace, using our JSR-107 extension as an example here
-->
<jcache:defaults>
<jcache:cache name="invoices" template="myDefaultTemplate"/>
</jcache:defaults>
</ehcache:service>
<!--
OPTIONAL
A <cache> element defines a cache, identified by the mandatory 'alias' attribute, to be managed by the CacheManager
-->
<ehcache:cache alias="productCache">
<!--
OPTIONAL, defaults to java.lang.Object
The FQCN of the type of keys K we'll use with the Cache<K, V>
-->
<ehcache:key-type copier="org.ehcache.impl.copy.SerializingCopier">java.lang.Long</ehcache:key-type>
<!--
OPTIONAL, defaults to java.lang.Object
The FQCN of the type of values V we'll use with the Cache<K, V>
-->
<ehcache:value-type copier="org.ehcache.impl.copy.SerializingCopier">com.pany.domain.Product</ehcache:value-type>
<!--
OPTIONAL, defaults to no expiry
Entries to the Cache can be made to expire after a given time
-->
<ehcache:expiry>
<!--
time to idle, the maximum time for an entry to remain untouched
Entries to the Cache can be made to expire after a given time
other options are:
* <ttl>, time to live;
* <class>, for a custom Expiry implementation; or
* <none>, for no expiry
-->
<ehcache:tti unit="minutes">2</ehcache:tti>
</ehcache:expiry>
<!--
OPTIONAL, defaults to no advice
An eviction advisor, which lets you control what entries should only get evicted as last resort
FQCN of a org.ehcache.config.EvictionAdvisor implementation
-->
<ehcache:eviction-advisor>com.pany.ehcache.MyEvictionAdvisor</ehcache:eviction-advisor>
<!--
OPTIONAL,
Let's you configure your cache as a "cache-through",
i.e. a Cache that uses a CacheLoaderWriter to load on misses, and write on mutative operations.
-->
<ehcache:loader-writer>
<!--
The FQCN implementing org.ehcache.spi.loaderwriter.CacheLoaderWriter
-->
<ehcache:class>com.pany.ehcache.integration.ProductCacheLoaderWriter</ehcache:class>
<!-- Any further elements in another namespace -->
</ehcache:loader-writer>
<!--
The maximal number of entries to be held in the Cache, prior to eviction starting
-->
<ehcache:heap unit="entries">200</ehcache:heap>
<!--
OPTIONAL
Any further elements in another namespace
-->
</ehcache:cache>
<!--
OPTIONAL
A <cache-template> defines a named template that can be used in <cache> definitions in this same file
They have all the same property as the <cache> elements above
-->
<ehcache:cache-template name="myDefaultTemplate">
<ehcache:expiry>
<ehcache:none/>
</ehcache:expiry>
<!--
OPTIONAL
Any further elements in another namespace
-->
</ehcache:cache-template>
<!--
A <cache> that uses the template above by referencing the cache-template's name in the uses-template attribute:
-->
<ehcache:cache alias="customerCache" uses-template="myDefaultTemplate">
<!--
Adds the key and value type configuration
-->
<ehcache:key-type>java.lang.Long</ehcache:key-type>
<ehcache:value-type>com.pany.domain.Customer</ehcache:value-type>
<!--
Overwrites the capacity limit set by the template to a new value
-->
<ehcache:heap unit="entries">200</ehcache:heap>
</ehcache:cache>
</ehcache:config>