Free web hosts - CHAPTER 13 Optimizing fetching and caching

CHAPTER 13 Optimizing fetching and caching You apply a read-only strategy for the Bid class: Bid data is therefore never expired from the cache, because it can only be created and never updated. (Bids may of course be expired by the cache provider for example, if the maximum number of objects in the cache is reached.) Hibernate also removes the data from the cache if a Bid instance is deleted, but it doesn t provide any transactional guarantees in doing so. User is an example of a class that could be cached with the nonstrict-read-write strategy, but we aren t certain that it makes sense to cache users. Let s set the cache provider, its expiration policies, and the physical regions of your cache. You use cache regions to configure class and collection caching individually. 13.4.2 Understanding cache regions Hibernate keeps different classes/collections in different cache regions. A region is a named cache: a handle by which you may reference classes and collections in the cache provider configuration and set the expiration policies applicable to that region. A more graphical description is that regions are buckets of data, of which there are two types: One type of region contains the disassembled data of entity instances, and the other type contains only identifiers of entities that are linked through a collection. The name of the region is the class name in the case of a class cache, or the class name together with the property name in the case of a collection cache. Category instances are cached in a region named auction.model.Category, whereas the items collection is cached in a region named auction.model.Category.items. The Hibernate configuration property named hibernate.cache.region_pre fix may be used to specify a region name prefix for a particular SessionFactory or persistence unit. For example, if the prefix is set to db1, Category is cached in
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

Leave a Reply