Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxBytesLocalDisk not observed #62

Open
n1zea144 opened this issue Apr 15, 2019 · 1 comment
Open

maxBytesLocalDisk not observed #62

n1zea144 opened this issue Apr 15, 2019 · 1 comment

Comments

@n1zea144
Copy link

I'm revisiting the use of mybatis/ehcache-cache in a web application. I have setup a few MyBatis mappers to use org.mybatis.caches.ehcache.EhcacheCache and I have them configured via a central ehcache.xml file with individual cache managers () configured for each mapper.

Using a profiler and viewing MBeans for net.sf.ehcache, I can see the mappers being setup according to my configuration, what I don't see is a respect for the maxBytesLocalDisk setting I provide. In other words, as I query my website, and run the disk usage command on my file system, looking at the mybatis cache path, the disk usage seems to grow without limit.

I've tried both setting a global maxBytesLocal disk as well as a maxBytesLocalDisk at an individual cache manager level. Below is my latest setup.

Snippet from mapper.xml file:

<mapper namespace="org.cbioportal.persistence.mybatis.SampleMapper"> <cache readOnly="true" type="org.mybatis.caches.ehcache.EhcacheCache"/>
...
</mapper>

Snippet from ehcache.xml:

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="false" monitoring="autodetect" maxBytesLocalDisk="${mybatis.cache.maxBytesLocalDisk}" dynamicConfig="true" name="myapp-ehcache">

<cache name="org.cbioportal.persistence.mybatis.SampleMapper" statistics="${mybatis.cache.statistics}" maxEntriesLocalHeap="${mybatis.cache.SampleMapper.entrysize}">
<persistence strategy="localTempSwap"/>
</cache>
</ehcache>

For testing I currently have mybatis.cache.maxBytesLocalDisk set to 10M, but I'm already at 145M after a few queries:
du -sh ~/local/apache-tomcat/ehcache/org%002ecbioportal%002epersistence%002emybatis%002e%0053ample%004dapper.data
145M /Users/grossb1/local/apache-tomcat/ehcache/org%002ecbioportal%002epersistence%002emybatis%002e%0053ample%004dapper.data

This latest configuration sets a global maxBytesLocalDisk (within ehcache element), but I've tried to set them at the mapper/cache manager level (within cache element) with the same result.

Any ideas what I'm doing wrong?

Thanks for your time and attention to this matter - and thanks for the library, very useful in my application!

@hazendaz
Copy link
Member

Sorry this was missed. This class contains what is supported from mybatis. I think you just need to adjust to the other two options for saving to get what you need.

https://github.com/mybatis/ehcache-cache/blob/master/src/main/java/org/mybatis/caches/ehcache/AbstractEhcacheCache.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants