同一个tomcat下的两个项目之间可以共用同一片ehcache缓存么?

鸡动个蛋 鸡动个蛋 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
情景如下:
A项目得到一个地理位置信息 需要在B项目中保存入库并且存入缓存
现在A不想去调B的接口去实现这个功能
A想在本地保存到ehcache缓存中 使用同一个cacheName 让B直接从机器中拿到相对应的缓存信息
可是现在B拿不到A的值
请问是需要其他的配置信息么?
现有配置信息如下
A:
<ehcache>

<diskStore path="java.io.tmpdir/i5xwxplus" />

<defaultCache
maxElementsInMemory="1000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true" />
<cache
name="i5xwxplus"
maxElementsInMemory="50000"
eternal="false"
overflowToDisk="true"
timeToIdleSeconds="1800"
timeToLiveSeconds="1800"
diskPersistent="false"
memoryStoreEvictionPolicy="LFU" >

</cache>
</ehcache>

B和A一样
求大神指导!
...全文

相关推荐

借助Ehcache缓存框架实现对页面的缓存Demo

本工程用于研究如何借助Ehcache缓存框架实现对页面的缓存 本工程编码方式:UTF-8 本工程开发工具:MyEclipse 说明: 1、ehcache.xml和ehcache.xsd两个文件可以在下在下载下来的名为“ehcache-core-x.x.x-distribution.tar.gz”压缩文件中找到 2、由于要实现Ehcache缓存页面,所以必须要添加“ehcache-web-2.0.4.jar” jar包,该jar包主要用于辅助Ehcache实现页面缓存 注意: 本web工程的发布不要使用Tomcat7,否则会出现如下异常: 2015-3-25 9:53:50 org.apache.catalina.loader.WebappClassLoader loadClass 信息: Illegal access: this web application instance has been stopped already. Could not load net.sf.ehcache.store.disk.DiskStore$KeySet. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. java.lang.IllegalStateException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1600) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at net.sf.ehcache.store.disk.DiskStore.keySet(DiskStore.java:560) at net.sf.ehcache.store.disk.DiskStorageFactory$DiskExpiryTask.run(DiskStorageFactory.java:838) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) 相关jar包下载地址: Ehcache 对象、数据缓存:http://ehcache.org/downloads/destination?name=ehcache-core-2.5.2-distribution.tar.gz&bucket=tcdistributions&file=ehcache

程序猿老高

EHCache缓存的说明和测试

EHCache缓存的说明文档是到处找来的内容,都有参考链接指向原地址。有三个测试项目也在里面:一个整合了Struts2或Hibernate,一个整合了MyBatis3,这两个是我做的;另一个ehcachetest是下载了別人的。

日月递照

ehcache页面缓存技术

ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术ehcache页面缓存技术

风中翔

详解Tomcat多域名配置(多个项目共用80端口)

本篇文章主要介绍了Tomcat多域名配置(多个项目共用80端口),具有一定的参考价值,感兴趣的小伙伴们可以参考一下

皮卡丘穿皮裤

如何清除tomcat缓存

发布了程序后,需要清楚缓存。本文详细介绍了如何清除tomcat缓存,

huguoyuan123
评论 12
收藏 已收藏
分享
返回顶部
鸡动个蛋
Web 开发 81,108 成员 341,721 内容