0

Is it possible to cache the routes' responses in Spring cloud gateway?

I have 2 routes defined

routes:
    - id: users
      uri: ${my_user_service.url}/users
      order: 10000
      predicates:
        - Path=/users
  
     - id: test
      uri: ${my_test_service.url}/test
      predicates:
        - Path=/test

Basically I would like to cache the result of the route with id 'users' in order to call my_user_service only once per user (depending on the request body)

Fabry
  • 1,498
  • 4
  • 23
  • 47
  • For sure you can use Hibernate's second-level-cache (db queries), as for caching the whole requests on backend - I'd be carefull, see what http://owasp.org has to say about that.. – k-wasilewski Dec 27 '20 at 18:19
  • Answered here: https://stackoverflow.com/questions/65498001/spring-cloud-gateway-with-spring-cache-and-caffeine – Fabry Dec 30 '20 at 09:37

0 Answers0