Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda