“Failed to delete drive storage entry for [Class]” in Grails - how to disable drive-based caching?

I get the following exception in a Grails application:

[1564928] store.DiskStore ClassNameCache: Could not remove disk store entry for ClassName#123195371. Error was null
java.io.EOFException
       at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2297)
       at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2766)
       at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:797)
       at java.io.ObjectInputStream.<init>(ObjectInputStream.java:297)
       at net.sf.ehcache.store.DiskStore$1.<init>(DiskStore.java:316)
       at net.sf.ehcache.store.DiskStore.loadElementFromDiskElement(DiskStore.java:316)
       at net.sf.ehcache.store.DiskStore.expireElements(DiskStore.java:973)
       at net.sf.ehcache.store.DiskStore.throwableSafeExpireElementsIfRequired(DiskStore.java:657)
       at net.sf.ehcache.store.DiskStore.spoolAndExpiryThreadMain(DiskStore.java:645)
       at net.sf.ehcache.store.DiskStore.access$900(DiskStore.java:68)
       at net.sf.ehcache.store.DiskStore$SpoolAndExpiryThread.run(DiskStore.java:1110)

DataSourceHibernate related settings are as follows:

hibernate {
    cache.use_second_level_cache=true
    cache.use_query_cache=true
    cache.provider_class='net.sf.ehcache.hibernate.EhCacheProvider'
}

It seems that the current cache setting is being written to /tmp/tomcat6-tmp/.

I would like to completely disable caching to disk and instead only cache in memory. How to do it?

+3
source share
1 answer

ehcache.xml , ehcache . ( grails-app/conf src/java), . http://ehcache.org/ehcache.xml .

- ; , ( ) , , :

<ehcache>

   <diskStore path='java.io.tmpdir' />

   <defaultCache
      maxElementsInMemory='10000'
      eternal='false'
      timeToIdleSeconds='120'
      timeToLiveSeconds='120'
      overflowToDisk='true'
      maxElementsOnDisk='10000000'
      diskPersistent='false'
      diskExpiryThreadIntervalSeconds='120'
      memoryStoreEvictionPolicy='LRU'
   />

   <cache name='com.yourcompany.yourapp.DomainClassName'
      maxElementsInMemory='1000'
      overflowToDisk='false'
   />

   <!-- hibernate stuff -->
   <cache name='org.hibernate.cache.StandardQueryCache'
      maxElementsInMemory='50'
      eternal='false'
      timeToLiveSeconds='120'
      maxElementsOnDisk='0'
   />

   <cache name='org.hibernate.cache.UpdateTimestampsCache'
      maxElementsInMemory='5000'
      eternal='true'
      maxElementsOnDisk='0'
   />

</ehcache>

Hibernate, .

+2

Source: https://habr.com/ru/post/1783276/


All Articles