<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="ehcache.xsd">

    <diskStore path="java.io.tmpdir"/>

    <cacheManagerEventListenerFactory class="" properties=""/>

	<!--  configuracion del cluster utilizando configCluster/* -->
	<!--Cluster automatico multicast en localhost--><cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"            properties="peerDiscovery=automatic,                        multicastGroupAddress=230.0.0.1,                        multicastGroupPort=4446, timeToLive=0"                        propertySeparator=","                          /><cacheManagerPeerListenerFactory            class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/>
  


    <!--
    Esta cache no esta siendo utilizada por Viafirma.
    Mandatory Default Cache configuration. These settings will be applied to caches
    created programmtically using CacheManager.add(String cacheName).

    The defaultCache has an implicit name "default" which is a reserved cache name.
    -->
    <defaultCache
            maxElementsInMemory="10000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />


    <!--
  Configuracion en cluster de la cache de certificados.
  Numero maximo de elementos en memoria:  1000 certificados.
  25 minutos * 60 con los documentos vivos.
    -->
    <cache name="CACHE_CERTIFICADOS"
           maxElementsInMemory="1000"
           eternal="false"
           timeToIdleSeconds="1800"
           timeToLiveSeconds="1800"
           overflowToDisk="true">

		
                 
                            
    </cache>

	<!--  Configuracion para el cache de documentos en transido de la aplicacion.
	 30 minutos * 60 con los documentos vivos.
	 -->
    <cache name="CACHE_DOCUMENTOS"
           maxElementsInMemory="100"
           eternal="false"
           timeToIdleSeconds="1800"
           timeToLiveSeconds="1800"
           overflowToDisk="true" 
           diskPersistent="true" >

		
        
       
    </cache>

	<!--  Configuracion para el cache de documentos en transido de la aplicacion.
	 10 minutos * 60 con los documentos vivos.
	 -->
    <cache name="CACHE_CUSTODIA"
           maxElementsInMemory="50"
           eternal="false"
           timeToIdleSeconds="1500"
           timeToLiveSeconds="1500"
           overflowToDisk="true"
		diskPersistent="true" >

		
        
    </cache>
  <!--  Configuracion para que OpenID en servidor admita cluster  guardando en cache las asociaciones privadas. 
    	Almacen compartido para los handler de OpenID ( que deben permanecer como minimo durante 30 minutos )
    	La cache permanece 100min*60 =6000 segundos . -
    -->  
    <cache name="InEhCachePrivateHandleServerAssociations"
	           maxElementsInMemory="1000"
	           eternal="false"
	           timeToIdleSeconds="6000"
	           timeToLiveSeconds="6000"
	           overflowToDisk="true" 
	           diskPersistent="true" >
	
		
	</cache>
    <!--  Configuracion para que OpenID en servidor admita cluster  guardando en cache las asociaciones publicas handle-appid. 
    	Almacen compartido para los handler de OpenID ( que deben permanecer como minimo durante 30 minutos )
    	La cache permanece 100min*60 =6000 segundos . -
    -->        
    <cache name="InEhCacheSharedHandleServerAssociations"
	           maxElementsInMemory="1000"
	           eternal="false"
	           timeToIdleSeconds="6000"
	           timeToLiveSeconds="6000"
	           overflowToDisk="true"
	           diskPersistent="true" >
	
		
	</cache>  

  
    
    	<!--  Cache para almacenar las asociaciones a appId concretos. Se utiliza para no tener que volver
	a comprobar que una appId tiene permisos. -->
	 <cache name="CACHE_APPS_HANDLERS"
           maxElementsInMemory="100"
           eternal="false" 
           timeToIdleSeconds="0"
           timeToLiveSeconds="0"
           overflowToDisk="false"
           diskPersistent="false">
			<!-- Configuracion para puesta en cluster automatica.  -->       
	        <cacheEventListenerFactory
	                class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
	                properties="replicateAsynchronously=false, replicatePuts=true,
	                            replicateUpdates=true, replicateUpdatesViaCopy=true,
	                            replicateRemovals=true"/>
	                            
	       <bootstrapCacheLoaderFactory
	        class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
	        properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"
	        propertySeparator="," />
	           
	</cache>
	
	
		<!--  Cache en la que se guardan todas las aplicaciones que tienen permisos para utilizar viafirma,
		Esta cache siempre será compartida con ViafirmaManager para permitir gestionar la configuración -->
	<cache name="CACHE_APPLICATION"
           maxElementsInMemory="100"
           eternal="false" 
           timeToIdleSeconds="0"
           timeToLiveSeconds="0"
           overflowToDisk="true"
           diskPersistent="true">
			<!-- Configuracion para puesta en cluster automatica. -->
	        <cacheEventListenerFactory
	                class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
	                properties="replicateAsynchronously=false, replicatePuts=true,
	                            replicateUpdates=true, replicateUpdatesViaCopy=true,
	                            replicateRemovals=true, hostName=localhost"/>
	          <cacheEventListenerFactory
	                class="org.viafirma.config.cache.ConfigCacheEventListenerFactory"
	               />             
	                      
	       <bootstrapCacheLoaderFactory
	        class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
	        properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"
	        propertySeparator="," />
	           
	         
	</cache>	

<!--  Cache en la que se guardan los certificados globales que pueden ser compartidos por varias apps,
	Esta cache siempre será compartida con ViafirmaManager para permitir gestionar la configuración -->
	<cache name="CACHE_GLOBAL_CERTS"
           maxElementsInMemory="10000"
           eternal="false" 
           timeToIdleSeconds="0"
           timeToLiveSeconds="0"
           overflowToDisk="true"
           diskPersistent="true">
			<!-- Configuracion para puesta en cluster automatica. -->
	        <cacheEventListenerFactory
	                class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
	                properties="replicateAsynchronously=false, replicatePuts=true,
	                            replicateUpdates=true, replicateUpdatesViaCopy=true,
	                            replicateRemovals=true, hostName=localhost"/>
	          <cacheEventListenerFactory
	                class="org.viafirma.config.cache.ConfigCacheGlobalCertEventListenerFactory"
	               />             
	                      
	       <bootstrapCacheLoaderFactory
	        class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
	        properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"
	        propertySeparator="," />
	</cache>

</ehcache>