簡體   English   中英

具有Terracotta和Ehcache集成的Grails 2.1.1

[英]Grails 2.1.1 with Terracotta and Ehcache integration

我正在嘗試將Grails 2.1.1與Terracotta和Ehcache集成,但是無論如何我都沒有得到任何好的結果。

有人可以給我一些配置建議嗎? 我有點困惑。

現在正在處理主題。 首先在grails-app/conf目錄中創建ehcache.xml 它看起來應該像這樣:

<ehcache>                                                                                                                                                                                                                                      

 <terracottaConfig url="vm4:9510"/>                                                                                                                                                                                                           

  <defaultCache                                                                                                                                                                                                                                
      maxElementsInMemory="50"                                                                                                                                                                                                                 
      eternal="false"                                                                                                                                                                                                                          
      timeToIdleSeconds="20"                                                                                                                                                                                                                   
      timeToLiveSeconds="20"                                                                                                                                                                                                                   
      overflowToDisk="false"                                                                                                                                                                                                                   
      diskPersistent="false"                                                                                                                                                                                                                   
      memoryStoreEvictionPolicy="LRU"                                                                                                                                                                                                          
       />                                                                                                                                                                                                                                       

   <cache name="processedUrlCache"                                                                                                                                                                                                              
         maxElementsInMemory="50000"                                                                                                                                                                                                           
         eternal="true">                                                                                                                                                                                                                       
      <terracotta />                                                                                                                                                                                                                             
   </cache>                                                                                                                                                                                                                                     

</ehcache> 

考慮到terracottaConfig網址應指向Terracotta server所在的實際host:port。 確保您的tarracotta緩存節點具有<terracotta/>子節點(類似於我的processUrlCache條目)。

現在,將這三個jar放入您的項目lib目錄中: ehcache-core-ee-2.6.2.jarehcache-terracotta-ee-2.6.2.jarterracotta-toolkit-1.6-runtime-ee-5.2.0.jar

實際版本可能有所不同(但是應該與您的terracotta服務器上的版本完全相同,所以我的建議是從服務器lib目錄中獲取這些jar)。

現在,運行您的服務器( start-tc-server.shstart-tc-server.bat具體取決於Unix / Windows平台)並運行grails應用程序。 首先,我建議您通過在Config.groovy文件中啟用調試日志

debug 'net.sf.ehcache'

進入您的log4j部分。

讓我知道這對您有幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM