我试图将Grails 2.1.1与Terracotta和Ehcache整合,但我没有得到任何好的结果。
有人可以给我一些建议吗?我有点困惑。
答案 0 :(得分:0)
现在在subj上工作。
首先在ehcache.xml
目录中创建grails-app/conf
。看起来应该是这样的:
<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
所在的端口。确保您的tarracotta缓存节点具有<terracotta/>
子节点(类似于我的processUrlCache条目)。
现在,将这3个罐放入项目的lib目录中:
ehcache-core-ee-2.6.2.jar
,ehcache-terracotta-ee-2.6.2.jar
,terracotta-toolkit-1.6-runtime-ee-5.2.0.jar
实际版本可能有所不同(但它应该与terracotta
服务器上的版本完全相同,所以我的建议是从服务器lib目录中获取这些jar。)
现在,根据Unix / Windows平台运行您的服务器(start-tc-server.sh
或start-tc-server.bat
)并运行您的grails应用程序。首次启动时,我建议您通过添加
debug 'net.sf.ehcache'
进入log4j
部分。
让我知道它会对你有所帮助。