Eh Cache 3.6.0 @Cacheable не истекает даже после установки времени ttl при весенней загрузке - PullRequest
0 голосов
/ 10 декабря 2018

Я использую 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 в весенней загрузке приложения.

...