Skip to content

Commit

Permalink
feat: add max-age setting to http response
Browse files Browse the repository at this point in the history
  • Loading branch information
ambersun1234 committed Aug 24, 2024
1 parent 07cc266 commit 13e19ea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The tool is build to integrate with **static page** by default, specifically Git
## Features
+ Aggregate page view count (include redirect URL)
+ Cache page view count with Redis to prevent API rate limit
+ The http response is also cached to prevent unnecessary API call, default to `1 day`(since the view count is not updated frequently by the Google Analytics)
+ Easy deployment with Kubernetes(Helm Chart), Docker-Compose, or standalone

## Prerequisites
Expand Down
1 change: 1 addition & 0 deletions src/controller/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class ViewController {

this.logger.info("Views found in cache", { key, views });

res.setHeader("Cache-Control", "public, max-age=86400");
res.json({ views: parseInt(views) });
}

Expand Down

0 comments on commit 13e19ea

Please # to comment.