Extracted from the Ehcache jar bag.
<!--~ Licensed to the Apache software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ under the Apache License, Version 2.0 (the ~ "License"); Except in compliance ~ with the License. Obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ unless required by APPL Icable law or agreed to in writing, ~ software distributed under the License are distributed on a ~ "as is" BASIS, Witho UT warranties or CONDITIONS of any ~ KIND, either express or implied. See the License for the ~ specific language governing permissions and limitations ~ under the License. -<Ehcache> <!--sets the path to the directory where cache. data files is created. If the path is a Java System, the It is replaced by its value in the running VM. The following properties are Translated:user.home-user's home directory User.dir-user ' s current Working directory Java.io.tmpdir-default temp file path - <DiskstorePath= "Java.io.tmpdir/shiro-ehcache"/> <!--Default Cache configuration. These would applied to caches programmatically created through the CacheManager. The following attributes is required:maxelementsinmemory-sets the maximum number of objects that would be Created in memory eternal-sets whether elements is eternal. If Eternal, timeouts is ignored and the element is never expired. Overflowtodisk-sets whether elements can overflow to disk when the In-memory cache has reached the maxinmemory limit. The following attributes is optional:timetoidleseconds-sets the time to idle for an element before it Expires. i.e. the maximum amount of time between accesses before an element expires are only use D If the element is not eternal. Optional attribute. A value of 0means that a Element can idle for infinity. The default value is 0. Timetoliveseconds-sets the time to live for a element before it expires. i.e. the maximum time between creation time and when an element expires. Was only used if the element was not eternal. Optional attribute. A value of 0 means that and Element can live for infinity. The default value is 0. Diskpersistent-whether the disk store persists between restarts of the Virtual machine. The default value is False. Diskexpirythreadintervalseconds-the number of seconds between runs of the disk expiry thread. The default value is seconds. Memorystoreevictionpolicy-policy would be enforced upon reaching the Maxelementsinmemory Limit. The Default policy is Least recently used (specified as LRU). Other policies Available-first on first out (specified as FIFO) and less frequently Used (specified as LFU) - <Defaultcachemaxelementsinmemory= "10000"Eternal= "false"Timetoidleseconds= "+"Timetoliveseconds= "+"Overflowtodisk= "false"diskpersistent= "false"Diskexpirythreadintervalseconds= "+" /> <!--We want Eternal= "true" and no timetoidle or timeToLive settings because Shiro manages session expirations EXP licitly. If we set it to false and then set corresponding Timetoidle and TimeToLive properties, Ehcache would evict session s without Shiro ' s knowledge, which would cause many problems (e.g. "My Shiro Session timeout is-minutes-why is N ' t a session available after 2 minutes? " Answer-ehcache expired it due to the Timetoidle property set to + seconds.) Diskpersistent=true since we want an enterprise session management feature-ability to use sessions after even aft Er a JVM restart. - <Cachename= "Shiro-activesessioncache"maxelementsinmemory= "10000"Overflowtodisk= "true"Eternal= "true"Timetoliveseconds= "0"Timetoidleseconds= "0"diskpersistent= "true"Diskexpirythreadintervalseconds= "All"/> <Cachename= "Org.apache.shiro.realm.text.propertiesrealm-0-accounts"maxelementsinmemory= "+"Eternal= "true"Overflowtodisk= "true"/></Ehcache>
Ehcache Configuration Parameters Example