Using memcached as the configuration method of hibernate second-level distributed cache

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.