-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#376 added caching to improve load times when loading matrix
- Loading branch information
1 parent
dd32c99
commit 509963f
Showing
6 changed files
with
88 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/org/tb/common/configuration/HibernateSecondLevelCacheConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.tb.common.configuration; | ||
|
||
import org.hibernate.cache.jcache.ConfigSettings; | ||
|
||
import org.springframework.boot.autoconfigure.orm.jpa.HibernatePropertiesCustomizer; | ||
import org.springframework.cache.annotation.EnableCaching; | ||
import org.springframework.cache.jcache.JCacheCacheManager; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import javax.cache.CacheManager; | ||
import javax.cache.Caching; | ||
import javax.cache.spi.CachingProvider; | ||
|
||
@Configuration(proxyBeanMethods = false) | ||
@EnableCaching | ||
public class HibernateSecondLevelCacheConfiguration { | ||
|
||
@Bean | ||
public JCacheCacheManager cacheManager() { | ||
CachingProvider cachingProvider = Caching.getCachingProvider(); | ||
CacheManager cacheManager = cachingProvider.getCacheManager(); | ||
return new JCacheCacheManager(cacheManager); | ||
} | ||
|
||
@Bean | ||
public HibernatePropertiesCustomizer hibernateSecondLevelCacheCustomizer(JCacheCacheManager cacheManager) { | ||
return (properties) -> properties.put(ConfigSettings.CACHE_MANAGER, cacheManager.getCacheManager()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters