Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

131
Visualizações
How to refresh ConcurrentMapCache periodically in Spring 4?

If I am using @Cashable annotation to cache the results using a ConcurrentMapCacheManager, then how would I periodically refresh the cache in Spring 4.3.5?

It looks like Ehcache provides some implementation and it depends on the backing store, but I would like to understand in case I am not using any external cache backing store.

One option I am thinking about is to periodically call a method, but what implementation will go into that method? How will I collect and call all those cachable methods again?

It would be great to look at some examples.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

There is no direct spring abstraction for periodic cache refresh, you can also verify here from spring docs, but, you can achieve the same with the simple scheduled method using @Scheduled like below:

@Scheduled(cron = "${YOUR_CRON_INTERVAL}")
@CacheEvict(value = "yourCache", allEntries = true)
public void resetAllEntries() {
    //write the code to repopulate the cache again here
}
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda