Caching in practice a region named db1.auction.model.Category. This

Caching in practice a region named db1.auction.model.Category. This setting is necessary if your application works with multiple SessionFactory instances or persistence units. Without it, cache region names of different persistence units may conflict. Now that you know about cache regions, you can configure the physical properties of the auction.model.Category cache. First let s choose a cache provider. Suppose you re running your auction application in a single JVM, so you don t need a cluster-aware provider. 13.4.3 Setting up a local cache provider You need to set the configuration property that selects a cache provider: hibernate.cache.provider_class = org.hibernate.cache.EhCacheProvider You choose EHCache as your second-level cache in this case. Now, you need to specify the properties of the cache regions. EHCache has its own configuration file, ehcache.xml, in the classpath of the application. The Hibernate distribution comes bundled with example configuration files for all bundled cache providers, so we recommend that you read the usage comments in those files for detailed configuration and assume the defaults for all options we don t mention explicitly. A cache configuration in ehcache.xml for the Category class may look like this: There are a small number of Category instances. You therefore disable eviction by choosing a cache size limit greater than the number of categories in the system and setting eternal=”true”, disabling eviction by timeout. There is no need to expire cached data by timeout because the Category cache concurrency strategy is read-write and because there are no other applications changing category data directly in the database. You also disable disk-based cache overflow, because you know there are few instances of Category and so memory consumption won t be a problem. Bids, on the other hand, are small and immutable, but there are many of them, so you must configure EHCache to carefully manage the cache memory consumption. You use both an expiry timeout and a maximum cache size limit:
We recommend high quality webhost to host and run your jsp application: christian web host services.

Leave a Reply