Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why is org.hibernate.cache.Cache deprecated?

Tags:

java

hibernate

Not only this but also org.hibernate.cache.Cache.CacheProvider is also deprecated.

If these are then how are we supposed to create our own custom Caching Solutions ? Alternate method ?

like image 614
Basit Anwer Avatar asked Dec 02 '10 07:12

Basit Anwer


1 Answers

The JavaDoc explains it:

The legacy (and now deprecated) approach to caching is defined by the CacheProvider and Cache interfaces as well as the CacheConcurrencyStrategy interface along with the various implementations of all these interfaces. In that scheme, a CacheProvider defined how to configure and perform lifecycle operations in regards to a particular underlying caching library; it also defined how to build Cache instances which in turn defined how to access the "regions" of the underlying cache instance. For entity and collection data cache regions, CacheConcurrencyStrategy wrapped access to those cache regions to apply transactional/concurrent access semantics.

The improved approach is based on RegionFactory, the various Region specializations and the two access strategies contracts (EntityRegionAccessStrategy and CollectionRegionAccessStrategy).

To sum it up, there is a new improved API you should use.

like image 154
Thilo Avatar answered Sep 24 '22 12:09

Thilo