NHibernate third-party level two cache bug

Source: Internet
Author: User
Tags md5 encryption

Under the first use of nhibernate, fancy its level two cache, but found not to turn on the cache, the data is normal, once opened to find a lot of duplicate data, I tried the two cache implementations of NHibernate.Caches.MemCache and NHibernate.Caches.EnyimMemcached, and found that the bug was the same, and that using the nhibernate comes with the NHIBERNATE.CACHE.HASHTABL The Ecacheprovider cache implementation was found to be normal, so I guess it was a duplicate of the generated key, because Memcache (I use the Windows version) key can not be more than 250, so the extra long key will definitely be hashed, I used the anti-compilation tool to key out the NHibernate.Caches.MemCache code to debug it is really a lot of key hash into the same, such as the following two key:

Key1:

Edu.db:[email protected]:/* Criteria query */SELECT this_. newsclassify_id as newsclas1_11_0_, This_. Newsclassify_name as newsclas2_11_0_, This_. Newsclassify_path as newsclas3_11_0_, This_. Newsclassify_state as newsclas4_11_0_, This_. Newsclassify_icon as newsclas5_11_0_, This_. Newsclassify_parent as newsclas6_11_0_ from Newsclassify this_ WHERE this_. Newsclassify_name =? and This_. Newsclassify_state =?; Parameters: []; Named parameters: {' cp0 ' = ' The Application for study abroad ', ' cp1 ' = ' 1 '}; First row:0

Key2:

Edu.db:[email protected]:/* Criteria query */SELECT this_. newsclassify_id as newsclas1_11_0_, This_. Newsclassify_name as newsclas2_11_0_, This_. Newsclassify_path as newsclas3_11_0_, This_. Newsclassify_state as newsclas4_11_0_, This_. Newsclassify_icon as newsclas5_11_0_, This_. Newsclassify_parent as newsclas6_11_0_ from Newsclassify this_ WHERE this_. Newsclassify_name =? and This_. Newsclassify_state =?; Parameters: []; Named parameters: {' cp0 ' = ' doctoral student application ', ' cp1 ' = ' 1 '}; First row:0

The above two keys only the end of a few Chinese slightly different, the results are scattered into the bmrpnkl2zgfqs6v1butpo2rzr+4=, this repetition is too high (although the hash is inevitable)

I prepared the code deduction, the hash key place with MD5 encryption re-implementation, should be able to, the specific code is not sent, because no few code, I send this essay is to reflect this phenomenon.

NHibernate third-party level two cache bug

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.