Skip to content

Commit

Permalink
fix: add alias for default ehcache (#17887)
Browse files Browse the repository at this point in the history
  • Loading branch information
vietnguyen authored Jun 26, 2024
1 parent 139370f commit fbe637c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ArrayUtils;
import org.hibernate.SessionFactory;
import org.hibernate.cache.ehcache.ConfigSettings;
import org.hibernate.cache.ehcache.MissingCacheStrategy;
import org.hibernate.cache.ehcache.internal.EhcacheRegionFactory;
import org.hibernate.cfg.AvailableSettings;
import org.hisp.dhis.cache.DefaultHibernateCacheManager;
Expand Down Expand Up @@ -153,6 +155,7 @@ private Properties getAdditionalProperties(DhisConfigurationProvider dhisConfig)
properties.put(AvailableSettings.USE_SECOND_LEVEL_CACHE, "true");
properties.put(AvailableSettings.CACHE_REGION_FACTORY, EhcacheRegionFactory.class.getName());
properties.put(AvailableSettings.USE_QUERY_CACHE, dhisConfig.getProperty(USE_QUERY_CACHE));
properties.put(ConfigSettings.MISSING_CACHE_STRATEGY, MissingCacheStrategy.CREATE);
}

// TODO: this is anti-pattern and should be turn off
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ehcache>

<!-- Default cache -->

<!-- Default cache -->
<!--
Ensure that default cache has less frequent expiration than query cache
to avoid individual select queries per entity.
Expand All @@ -13,19 +12,20 @@
eternal="false"
timeToIdleSeconds="21600"
timeToLiveSeconds="21600"
overflowToDisk="false"
overflowToDisk="false"
diskPersistent="false" />

<!-- Hibernate query cache -->

<cache name="org.hibernate.cache.internal.StandardQueryCache"
<cache name="default-query-results-region"
maxElementsInMemory="1000000"
eternal="false"
timeToIdleSeconds="21600"
timeToLiveSeconds="21600"
overflowToDisk="false"
diskPersistent="false" />

<cache name="org.hibernate.cache.spi.UpdateTimestampsCache"
<cache name="default-update-timestamps-region"
maxElementsInMemory="5000" />

</ehcache>

0 comments on commit fbe637c

Please sign in to comment.