Eh Cache expiry time in Spring boot

I have created a spring boot application and implemented EhCache in the maven project. My xml configuration file for EhCache is as follows :

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" 
updateCheck="true"
monitoring="autodetect" 
dynamicConfig="true">

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

<cache name="labCabSourceInfoCache" 
    maxEntriesLocalHeap="10000"
    maxEntriesLocalDisk="1000" 
    eternal="false" 
    diskSpoolBufferSizeMB="20"
    timeToIdleSeconds="300" timeToLiveSeconds="300"
    memoryStoreEvictionPolicy="LFU" 
    transactionalMode="off">
    <persistence strategy="localTempSwap" />
</cache>

I have set expiry time as 300 in the parameters timeToIdleSeconds & timeToLiveSeconds

But it doesn’t works for me. I didn’t used any configuration bean for the cache implementaion. I uses @Cacheable annotation for the method which is meant to be used cache.

@Cacheable(value="labCabSourceInfoCache", key="#labAlias.concat(#Account)") 
public String findLabCabSourceInfo(String labAlias, String Account) { 
    try { 
        //codes return "some string" 
    } catch (Exception e) { } return null; 
}

Why it is not evicted or cleared?

You may need to enable the processing of the caching annotations.
Can you try adding @EnableCaching on your main class.

From the tutorial
https://spring.io/guides/gs/caching/

The @EnableCaching annotation triggers a post processor that inspects
every Spring bean for the presence of caching annotations on public
methods. If such an annotation is found, a proxy is automatically
created to intercept the method call and handle the caching behavior
accordingly.

Also you can add the following code in and then analyse thorough Jconsole, the details of the caches created in your application.

@Bean(initMethod="init")
@Autowired
public ManagementService managementService(CacheManager cacheManager,
              MBeanServer mBeanServer) {
       return new ManagementService(cacheManager, mBeanServer, true, true,true, true);
}