Skip to content

maxBytesLocalDisk not observed #62

@n1zea144

Description

@n1zea144

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions