2017-05-08 2 views
0

J'ai une application Spring/Tomcat et j'essaye de faire fonctionner ehcache comme un cache d'entité de second niveau Hibernate. C'est activé et actif. Je peux voir dans la sortie du journal de débogage combien d'entités sont mises en cache. Le problème est que toutes les quelques secondes, le cache se vide. J'ai même épinglé le cache (juste pour voir si cela modifier le comportement) et maintenant je vois ceci:Le cache de second niveau d'hibernation continue à se vider

05-08-2017 16:05:21.550 [taskExecutor-12] {env=''} WARN n.s.e.Cache: Data availability impacted: 
**************************************************************************************** 
************************** removeAll called on a pinned cache ************************** 

05-08-2017 16:05:21.550 [taskExecutor-12] {env=''} WARN n.s.e.Cache: Data availability impacted: 
**************************************************************************************** 
************************** removeAll called on a pinned cache ************************** 

Je pense donc que c'est le problème. Une idée de ce qui causerait removeAll implicitement appelé encore et encore?

ehcache.xml

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:noNamespaceSchemaLocation="ehcache.xsd" 
    updateCheck="true" 
    monitoring="autodetect" 
    maxBytesLocalHeap="24G" 
    dynamicConfig="true"> 

    <defaultCache eternal="true" maxBytesLocalHeap="1" /> <!-- not used, but required per ehcache configuration rules --> 

    <!-- cache for foo --> 
    <cache name="foo" 
      maxBytesLocalHeap="8G" 
      eternal="false" 
      memoryStoreEvictionPolicy="LRU" 
      timeToLiveSeconds="12000" 
      transactionalMode="off"> 
     <pinning store="inCache" /> 
     <persistence strategy="none" /> 
    </cache> 
</ehcache> 

persistence.xml

 <properties> 
      <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /> 
      <property name="hibernate.connection.driver_class" value="org.postgresql.Driver" /> 
      <property name="hibernate.show_sql" value="false" /> 
      <property name="hibernate.hbm2ddl.auto" value="update" /> 
      <property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy" /> 
      <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" /> 
      <property name="hibernate.cache.use_second_level_cache" value="true" /> 
      <property name="hibernate.cache.use_query_cache" value="false" /> 
      <property name="hibernate.generate_statistics" value="true" /> 
      <property name="hibernate.cache.use_structured_entries" value="true" /> 
      <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory" /> 
     </properties> 

Et ces annotations sont de la classe de modèle d'entité:

@Cacheable 
@Cache(region = "foo", usage = CacheConcurrencyStrategy.READ_WRITE) 

Répondre