Secondary Caches
Hibernate's secondary cache is a powerful tool that can greatly improve the performance of your application. By storing frequently accessed data in memory, the secondary cache can reduce the number of database queries that need to be made, resulting in faster response times and more efficient use of system resources. Whether you're working on a small project or a large enterprise application, the secondary cache is an essential part of any Hibernate-based system. So if you want to get the most out of your Hibernate application, take advantage of this powerful caching feature!

Please see the caching section for all the wonderful caching strategies you can do with Hibernate.
Configuration
A secondary cache provider is a class that manages a level of caching secondary to Hibernate's main caching context - the Hibernate session. A secondary cache enables longer-running cache contexts, more fine-grained control over cache busting, and other performance-related benefits.
The only setting necessary to enable secondary caching is the secondaryCacheEnabled setting:
To configure the caching, specify the path to an XML cache configuration file in cacheConfig:
This ehcache.xml cache configuration then should look something like this:
How the Cache Provider Setting Works
bx-orm bridges Hibernate's JCache (JSR-107) SPI to BoxLang's own CacheService, so cacheProvider selects a BoxLang cache provider by name rather than a specific Hibernate/EHCache implementation:
The default,
"BoxCacheProvider", uses BoxLang's built-in in-memory cache."ConcurrentHashMap"and"HashTable"are legacy aliases kept for CFML/Lucee compatibility; both simply resolve to the default BoxLang cache provider.Any other value must be the name of a cache provider already registered with BoxLang's
CacheService(e.g. via CacheBox). If no provider with that name is found, ORM startup throws an error.cacheConfigPropertieslets you pass secondary-cache settings as a BoxLang struct instead of (or alongside) an XMLcacheConfigfile.
See the Caching page for entity-level cache strategies (cacheUse).
Last updated
Was this helpful?