Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

Small Spring Boot demo app demonstrating how to use Spring Cache when integrating with slow external services

Notifications You must be signed in to change notification settings

acntech-archive/acntech-spring-cache-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-cache-demo

Small Spring Boot demo app demonstrating how to use Spring Cache when integrating with slow external services.

High level architecture

  1. There are two slow services, 1. SlowExternalUserService and 2. SuperSlowExternalService
  2. ScheduledCacheTask is responsible for initiating the Users cache at startup and refreshing the cache every 120 seconds (by using @Scheduled(fixedDelay)). This is done by calling the slow services and response is rewritten in the Users cache (by using @CachePut)
  3. UserResource (REST API) is retrieving the data from UserService, which reads cached data by using the CacheManager
  4. It takes about 10 seconds after startup before data from SlowExternalUserService is available and 20 seconds from SuperSlowExternalService

Getting started

$ ./mvnw spring-boot:run

REST APIs

About

Small Spring Boot demo app demonstrating how to use Spring Cache when integrating with slow external services

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published