Go to the official website: Workshop
Then configure the parameters in hibernate. cfg. XML (refer ):
Code
<! -- Enable Level 2 Cache -->
< Property Name = "Hibernate. cache. use_second_level_cache" >
True
</ Property >
<! -- Set cache provider -->
< Property Name = "Hibernate. cache. provider_class" >
Com. googlecode. hibernate. memcached. memcachedcacheprovider
</ Property >
<! -- Set the port of the memcached Cache Server -->
< Property Name = "Hibernate. memcached. servers" >
Localhost: 11211
</ Property >
<! -- Set the prefix name of the second-level cache -->
< Property Name = "Hibernate. cache. region_prefix" >
Quality. cache. ehcache
</ Property >
<! -- Whether to cache objects in a structured way -->
< Property Name = "Hibernate. cache. use_structured_entries" >
True
</ Property >
<! -- Cache query results? -->
< Property Name = "Hibernate. cache. use_query_cache" > True </ Property >
In this way, you can configure
Of course, this is a global configuration method, and the specific business needs to be configured according to the situation