Skip to content

Commit

Permalink
GH-113: Cache static resources for one hour
Browse files Browse the repository at this point in the history
  • Loading branch information
markhobson committed Jun 17, 2024
1 parent 790799c commit 1877b67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions schemes/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Config:
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_SAMESITE = "Lax"
PERMANENT_SESSION_LIFETIME = timedelta(hours=1)
SEND_FILE_MAX_AGE_DEFAULT = timedelta(hours=1)

# Flask-SQLAlchemy
SQLALCHEMY_DATABASE_URI = "sqlite+pysqlite:///:memory:"
Expand Down
5 changes: 5 additions & 0 deletions tests/integration/test_http_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ def test_views_are_not_stored(self, client: FlaskClient) -> None:
response = client.get("/")

assert response.headers.get("Cache-Control") == "no-store"

def test_static_resources_are_cached_publicly_for_one_hour(self, client: FlaskClient) -> None:
response = client.get("/static/application.min.css")

assert response.headers.get("Cache-Control") == "public, max-age=3600"

0 comments on commit 1877b67

Please sign in to comment.