Я использую EhCache 3.6.0 в своем весеннем загрузочном приложении для кеширования.
POM.xml
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.6.0</version>
</dependency>
<!-- Spring Framework Caching Support -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
ehcache.xml
<ehcache xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation = "ehcache.xsd"
updateCheck = "true"
monitoring = "autodetect"
dynamicConfig = "true">
<cache name = "customattributes"
maxElementsInMemory = "100"
eternal = "false"
overflowToDisk = "false"
timeToLiveSeconds = "60"
timeToIdleSeconds = "0"
memoryStoreEvictionPolicy = "LFU"
transactionalMode = "off">
</cache>
</ehcache>
ServiceImpl.java
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
@Override
@Cacheable("customattributes")
public List<custom> getcustom(Long id)
{
List<Custom> customList =dao.getAllCustoms();
return customList;
}
Application.java
@SpringBootApplication
@EnableCaching
public class LeadApplication
{
public static void main(String[] args)
{
SpringApplication.run(LeadApplication.class, args);
}
}
Пожалуйста, посоветуйте мне истечь срок действия кеша после установки времени ttl в приложении весенней загрузки.
Что вы делаете или наблюдаете, чтобы сказать, что срок действия записи в кеше не истекает?