Debian Codegraph @

src/test/resources/ehcache-countinglisteners.xml

raw
1 <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../main/config/ehcache.xsd">
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"/>
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="net.sf.ehcache.event.TestCacheManagerEventListenerFactory"
35 properties="type=counting"/>
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 <cacheEventListenerFactory class="net.sf.ehcache.event.NullCacheEventListenerFactory"/>
82 <cacheEventListenerFactory class="net.sf.ehcache.event.CountingCacheEventListenerFactory"/>
83 </defaultCache>
84 <!--Predefined caches. Add your cache configuration settings here.
85 If you do not have a configuration for your cache a WARNING will be issued when the
86 CacheManager starts
87
88 The following attributes are required for defaultCache:
89
90 name - Sets the name of the cache. This is used to identify the cache.
91 It must be unique.
92 maxElementsInMemory - Sets the maximum number of objects that will be created in memory
93 eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the
94 element is never expired.
95 overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache
96 has reached the maxInMemory limit.
97
98 The following attributes are optional:
99 timeToIdleSeconds - Sets the time to idle for an element before it expires.
100 i.e. The maximum amount of time between accesses before an element expires
101 Is only used if the element is not eternal.
102 Optional attribute. A value of 0 means that an Element can idle for infinity.
103 The default value is 0.
104 timeToLiveSeconds - Sets the time to live for an element before it expires.
105 i.e. The maximum time between creation time and when an element expires.
106 Is only used if the element is not eternal.
107 Optional attribute. A value of 0 means that and Element can live for infinity.
108 The default value is 0.
109 diskPersistent - Whether the disk store persists between restarts of the Virtual Machine.
110 The default value is false.
111 diskExpiryThreadIntervalSeconds- The number of seconds between runs of the disk expiry thread. The default value
112 is 120 seconds.
113 memoryStoreEvictionPolicy - Policy would be enforced upon reaching the maxElementsInMemory limit. Default
114 policy is Least Recently Used (specified as LRU). Other policies available -
115 First In First Out (specified as FIFO) and Less Frequently Used
116 (specified as LFU)
117 cacheEventListenerClassNames - A comma separated list of CacheEventListeners. The fully qualified class name of
118 the class which implements CacheEventListener is required.
119 Registered listeners will be notified of cache events such as Element puts, removes and expiries
120 and Cache status changes. The default if unspecified is an empty notifications list
121 which does nothing.
122 -->
123 <!-- Sample cache named sampleCache1 -->
124 <cache name="sampleCache1"
125 maxElementsInMemory="10"
126 maxElementsOnDisk="20"
127 eternal="false"
128 timeToIdleSeconds="5"
129 timeToLiveSeconds="5"
130 overflowToDisk="true"
131 memoryStoreEvictionPolicy="LRU"
132 diskExpiryThreadIntervalSeconds="1">
133 <cacheEventListenerFactory class="net.sf.ehcache.event.NullCacheEventListenerFactory"/>
134 <cacheEventListenerFactory class="net.sf.ehcache.event.CountingCacheEventListenerFactory"/>
135 </cache>
136
137 <!-- Sample cache named sampleCache2. -->
138 <cache name="sampleCache2"
139 maxElementsInMemory="10"
140 eternal="false"
141 timeToLiveSeconds="1"
142 overflowToDisk="false">
143 <cacheEventListenerFactory class="net.sf.ehcache.event.CountingCacheEventListenerFactory"/>
144 </cache>
145
146
147 <!-- Sample cache named sampleCache3. -->
148 <cache name="sampleCache3"
149 maxElementsInMemory="10"
150 eternal="false"
151 timeToLiveSeconds="1"
152 overflowToDisk="false"
153 memoryStoreEvictionPolicy="FIFO">
154 <cacheEventListenerFactory class="net.sf.ehcache.event.CountingCacheEventListenerFactory"/>
155 </cache>
156
157 <!-- Sample cache named sampleCache4. -->
158 <cache name="sampleCache4"
159 maxElementsInMemory="10"
160 eternal="false"
161 timeToLiveSeconds="1"
162 overflowToDisk="false"
163 memoryStoreEvictionPolicy="LFU">
164 <cacheEventListenerFactory class="net.sf.ehcache.event.CountingCacheEventListenerFactory"/>
165 </cache>
166
167 <!-- Sample cache named sampleCacheNoIdle, which does not specify the optional idle time -->
168 <cache name="sampleCacheNoIdle"
169 maxElementsInMemory="1000"
170 eternal="false"
171 timeToLiveSeconds="5"
172 overflowToDisk="false"
173 />
174
175 <!-- Sample cache named sampleCacheNotEternalButNoIdleOrExpiry -->
176 <cache name="sampleCacheNotEternalButNoIdleOrExpiry"
177 maxElementsInMemory="1000"
178 eternal="false"
179 overflowToDisk="false"
180 />
181
182 <!-- A cache with short idle and live expiries, suitable for tests -->
183 <cache name="sampleIdlingExpiringCache"
184 maxElementsInMemory="1"
185 eternal="false"
186 timeToIdleSeconds="2"
187 timeToLiveSeconds="5"
188 overflowToDisk="true">
189 <cacheEventListenerFactory class="net.sf.ehcache.event.CountingCacheEventListenerFactory"/>
190 </cache>
191
192 <!-- A cache which overflows to disk. The disk store is persistent
193 between cache and VM restarts. The disk expiry thread interval is set to 10 minutes, overriding
194 the default of 2 minutes. -->
195 <cache name="persistentLongExpiryIntervalCache"
196 maxElementsInMemory="500"
197 eternal="false"
198 timeToIdleSeconds="300"
199 timeToLiveSeconds="600"
200 overflowToDisk="true"
201 diskPersistent="true"
202 diskExpiryThreadIntervalSeconds="600">
203 <cacheEventListenerFactory class="net.sf.ehcache.event.NullCacheEventListenerFactory"/>
204 </cache>
205
206 <!-- Page Caches -->
207
208 <cache name="CachedLogin"
209 maxElementsInMemory="10"
210 eternal="false"
211 timeToIdleSeconds="10000"
212 timeToLiveSeconds="10000"
213 overflowToDisk="true">
214 <cacheEventListenerFactory class="net.sf.ehcache.event.CountingCacheEventListenerFactory"/>
215 </cache>
216
217 <cache name="FooterPageCache"
218 maxElementsInMemory="10"
219 eternal="false"
220 timeToIdleSeconds="10000"
221 timeToLiveSeconds="10000"
222 overflowToDisk="true"
223 />
224
225 </ehcache>