Skip to content

Added middleware that provides cache-control headers - #19

Open
tmolteno wants to merge 4 commits into
mainfrom
cache-control
Open

Added middleware that provides cache-control headers#19
tmolteno wants to merge 4 commits into
mainfrom
cache-control

Conversation

@tmolteno

@tmolteno tmolteno commented Apr 9, 2026

Copy link
Copy Markdown
Member

I've added some middleware to do basic cache-control headers. Seems to work pretty well in testing.

The default is 300 seconds. I've added some exceptions

app.add_middleware(
    client_cache_middleware.AdvancedClientCacheMiddleware,
    default_max_age=300,
    path_configs={
        "/auth": {"no_cache": True},                          # No cache for auth endpoints
        "/imaging/antenna_positions": {"max_age": 600},         # No cache for auth endpoints
        "/imaging/vis": {"max_age": 15},        # 15 second cache for vis data
        "/vis/data": {"max_age": 60},        # 60 second cache for vis data
        "/raw/data": {"max_age": 60},        # 60 second cache for vis data
    }
)

@tmolteno
tmolteno requested a review from maxscheel April 9, 2026 05:07
@tmolteno tmolteno added the enhancement New feature or request label Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant