spring-cloud / spring-cloud/spring-cloud-gateway

DRAFT - Response Cache re-design for future releases

Open
#2,889 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
4.9k
Forks
3.5k
Avg merge
20h 57m
Merged PRs (30d)
8

Description

The global response cache and the LocalResponseCache filter are different components, however, the global depends on the local filter, which seems a bit confusing. On the other hand, having the global filter flag enabled and having the LocalResponseCache filter deactivated doesn't make sense. Also, this filter is intended for one Cache per Route, but because of the nature of a filter, the filter can be applied several times to the same route having multiple caches for a single route which can introduce glitches.

spring:
  cloud:
    gateway:
      filter:
       local-response-cache:
          enabled: true
      global-filter:
        local-response-cache:
          enabled: true
      routes:
        - id: route-1
          metadata:
            local-response-cache:
              size: 1MB
              time-to-live: 30m
          ...

The request passes through the filters as

*LocalResponseCache (if present in the route) -> Global (response cache)

A new approach is to have one flag for activating a global response cache, that can be customised for specific routes using metadata section.

spring:
  cloud:
    gateway:
      global-filter:
        local-response-cache:
          enabled: true
      routes:
        - id: route-1
          metadata:
            local-response-cache:
              size: 1MB
              time-to-live: 30m
          ...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the global response cache and the LocalResponseCache filter, then trace how both are activated and applied to routes. Compare that behavior with the proposed single global flag and route-level metadata configuration. Done means one cache path is used per route, with global activation and route customization behaving consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
api, backend, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.