EhCache: Why is my diskStore path directory not created?

I work with ehcache. I cache the Spring @Service method:

@Service( value = "dataServicesManager" )
@Transactional
public class DataServicesManager implements IDataServicesManager{

    @Autowired
    private IDataDAO dataDAO;



    @Override
    @Cacheable( value = "alldatas" )
    public List<Data> getAllDatas(Integer param) {

                // my logic

        return results;

    }
// others services
}

Here is a Spring configuration snippet:

 <cache:annotation-driven/>

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
    <property name="cacheManager" ref="ehcache"/>
</bean>
<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
    <property name="configLocation" value="WEB-INF/ehcache.xml"/>
    <property name="shared" value="true"/>
</bean>

Here is my ehcache configuration.

<ehcache xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true" monitoring="autodetect" dynamicConfig="true">

<diskStore path="C:/TEMP/ehcache"/>

<defaultCache   eternal="false"
       timeToIdleSeconds="300"
       timeToLiveSeconds="1200"
       overflowToDisk="true"
       diskPersistent="false"
       diskExpiryThreadIntervalSeconds="120" />

<cache name="alldatas" maxEntriesLocalHeap="10000" eternal="false"
        timeToIdleSeconds="21600" timeToLiveSeconds="21600" memoryStoreEvictionPolicy="LRU">

    </cache>

</ehcache>

When I call the getAllDatas method of the service from Spring @Controller, the method is cached, and the second call causes the storage to be restored in the cache. I do not understand that I cannot find the parameter <diskStore path="C:/TEMP/ehcache"/>in the ehcache.xml file. Therefore, I have two questions:

Question 1: Why is the C: / TEMP / ehcache directory not created?

Question 2: Where are my service results cached?

+4
source share
2 answers

Your Ehcache configuration is to blame.

defaultCache .

alldatas - .

, :

<cache name="alldatas" maxEntriesLocalHeap="10000" eternal="false"
    timeToIdleSeconds="21600" timeToLiveSeconds="21600" memoryStoreEvictionPolicy="LRU"
    overflowToDisk="true"
    diskPersistent="false"
    diskExpiryThreadIntervalSeconds="120">

</cache> 

.

, defaultCache .

+2

, . , - . maxEntriesLocalHeap , , , .

0

All Articles