<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2010, Sebastian Sdorra
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice,
       this list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright notice,
       this list of conditions and the following disclaimer in the documentation
       and/or other materials provided with the distribution.
    3. Neither the name of SCM-Manager; nor the names of its
       contributors may be used to endorse or promote products derived from this
       software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
    ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    http://bitbucket.org/sdorra/scm-manager


-->

<!--
    Document   : ehcache.xml
    Created on : October 14, 2010, 6:54 AM
    Author     : sdorra
    Description:
        Purpose of the document follows.
-->

<ehcache xmlns="http://ehcache.org/ehcache.xsd"
         updateCheck="false"
         maxBytesLocalDisk="512M">


  <!--
    Sets the path to the directory where cache .data files are created.

    If the path is a Java System Property 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
  -->
  
  <diskStore path="java.io.tmpdir"/>


  <!--
    Default Cache configuration. These will applied to caches programmatically created through
    the CacheManager.

    The following attributes are required:

    maxElementsInMemory            - Sets the maximum number of objects that will be created in memory
    eternal                        - Sets whether elements are eternal. If eternal,  timeouts are 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 are 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
                                     Is only used if the element is not eternal.
                                     Optional attribute. A value of 0 means that an Element can idle for infinity.
                                     The default value is 0.
    timeToLiveSeconds              - Sets the time to live for an element before it expires.
                                     i.e. The maximum time between creation time and when an element expires.
                                     Is only used if the element is 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 120 seconds.
  -->

  <defaultCache
        maxEntriesLocalHeap="100"
        maxEntriesLocalDisk="10000"
        eternal="false"
        overflowToDisk="true"
        timeToIdleSeconds="1200"
        timeToLiveSeconds="2400"
        diskPersistent="false"
        diskExpiryThreadIntervalSeconds="120"
  />

  <!--
    Authentication cache
    average: 1K
  -->
  <cache
        name="sonia.cache.auth"
        maxEntriesLocalHeap="1000"
        eternal="false"
        overflowToDisk="false"
        timeToIdleSeconds="30"
        timeToLiveSeconds="60"
        diskPersistent="false"
  />
  
  <!--
    Authorization cache
    average: 3K
  -->
  <cache
        name="sonia.cache.authorizing"
        maxEntriesLocalHeap="1000"
        eternal="false"
        overflowToDisk="false"
        timeToIdleSeconds="1200"
        timeToLiveSeconds="2400"
        diskPersistent="false"
        copyOnRead="true"
  />
  
  <!--
    PluginCenter cache
    average: 30K
  -->
  <cache
        name="sonia.cache.plugins"
        maxEntriesLocalHeap="5"
        eternal="false"
        overflowToDisk="false"
        timeToLiveSeconds="3600"
        diskPersistent="false"
  />

  <!-- 
    Search cache for users
    average: 0.5K
  -->
  <cache
        name="sonia.cache.search.users"
        maxEntriesLocalHeap="10000"
        eternal="false"
        overflowToDisk="false"
        timeToLiveSeconds="5400"
        diskPersistent="false"
  />

  <!-- 
    Search cache for groups
    average: 0.5K
  -->
  <cache
        name="sonia.cache.search.groups"
        maxEntriesLocalHeap="1000"
        eternal="false"
        overflowToDisk="false"
        timeToLiveSeconds="5400"
        diskPersistent="false"
  />
  
  <!-- new repository api -->
  
  <!--
    Changeset cache
    average: 25K
  -->
  <cache
        name="sonia.cache.cmd.log"
        maxEntriesLocalHeap="200"
        maxEntriesLocalDisk="10000"
        eternal="true"
        overflowToDisk="true"
        diskPersistent="false"
        copyOnRead="true"
        copyOnWrite="true"
  />
  
  <!--
    FileObject cache
    average: 1.5K
  -->
  <cache
        name="sonia.cache.cmd.browse"
        maxEntriesLocalHeap="3000"
        maxEntriesLocalDisk="20000"
        eternal="true"
        overflowToDisk="true"
        diskPersistent="false"
        copyOnRead="true"
        copyOnWrite="true"
  />

  <!--
    BlameResult cache
    average: 15K
  -->
  <cache
        name="sonia.cache.cmd.blame"
        maxEntriesLocalHeap="1000"
        maxEntriesLocalDisk="10000"
        eternal="true"
        overflowToDisk="true"
        diskPersistent="false"
        copyOnRead="true"
        copyOnWrite="true"
  />
  
  <!--
    Tag cache
    average: 5K
  -->
  <cache
        name="sonia.cache.cmd.tags"
        maxEntriesLocalHeap="500"
        eternal="true"
        overflowToDisk="false"
        diskPersistent="false"
  />
  
  <!--
    Branch cache
    average: 2.5K
  -->
  <cache
        name="sonia.cache.cmd.branches"
        maxEntriesLocalHeap="1000"
        eternal="true"
        overflowToDisk="false"
        diskPersistent="false"
  />
  
  <!-- deprecated old repository api -->
  
  <cache
        name="sonia.cache.repository.changesets"
        maxEntriesLocalHeap="200"
        eternal="false"
        overflowToDisk="false"
        timeToLiveSeconds="86400"
        diskPersistent="false"
  />
  
  <cache
        name="sonia.cache.repository.browser"
        maxEntriesLocalHeap="200"
        eternal="false"
        overflowToDisk="false"
        timeToLiveSeconds="86400"
        diskPersistent="false"
  />
  
  <cache
        name="sonia.cache.repository.blame"
        maxEntriesLocalHeap="100"
        eternal="false"
        overflowToDisk="false"
        timeToLiveSeconds="86400"
        diskPersistent="false"
  />
  
</ehcache>
