我使用JCS进行缓存。我已经在我的PC上实现了这一点,它的工作正常,但在我们的Tomcat服务器以及我的同事PC上出现了错误Failed to load properties for name [/cache.ccf]。
jar文件已正确安装,并且cache.ccf文件位于与我的PC相同的位置,所以我不明白为什么它对我成功,否则失败。
我用来获取JCS缓存实例的代码是:
JCS.setConfigFilename("/cache.ccf");
printOddsCache = JCS.getInstance(PRINTODDSCACHE_REGION_NAME);cache.ccf文件包含以下内容:
jcs.default=
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=200001
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.default.cacheattributes.UseMemoryShrinker=true
jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.default.cacheattributes.ShrinkerIntervalSeconds=60
jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.default.elementattributes.IsEternal=false*解决方案编辑--我从头开始重写了cache.ccf --现在似乎没有任何错误。
发布于 2013-10-04 14:45:51
我现在从事的项目中也有类似的问题。从这里开始,解决方案对我帮助很大:How to change JCS cache.ccf file's path? --我现在认为配置类比普通属性文件更不方便,但在本例中,这是我找到的最好的解决方案。
https://stackoverflow.com/questions/19160864
复制相似问题