NHibernate第三方二級緩衝bug

來源:互聯網
上載者:User

標籤:重複資料   留學   tab   它的   準備   複數   iter   from   md5   

在下第一次使用NHibernate,看中了它的二級緩衝,不過發現不開啟緩衝的話,資料是正常的,一旦開啟就發現擷取了很多重複資料,我試了NHibernate.Caches.MemCache和NHibernate.Caches.EnyimMemcached這兩個緩衝實現,發現bug是一樣的,而使用NHibernate內建的NHibernate.Cache.HashtableCacheProvider緩衝實現發現是正常的,所以我猜測是產生的key重複了的問題,因為memcache(我用windows版本)的key最長不能超過250,所以肯定會對超長的key進行散列,我用反編譯工具把NHibernate.Caches.MemCache的代碼摳出來調試了一下果然很多key散列成了一樣的,比如下面這兩個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‘=‘專升本留學申請‘, ‘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‘=‘博士研究生申請‘, ‘cp1‘=‘1‘}; first row: 0

以上兩個key只有結尾處的幾個中文稍微有些區別,結果都散列成了bMRPNkL2ZgFqs6v1butPO2rZR+4=,這重複性太高了(雖然散列有重複是必然的)

我準備代碼扣出來,把散列key的地方用md5加密重新實現一下,應該就可以了,具體代碼就不發了,因為沒幾個代碼,我發這條隨筆就是把這個現象反應一下。

NHibernate第三方二級緩衝bug

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.