Skip to content

Commit 987e5f1

Browse files
committed
Fix caching: Add no-cache headers and update README with cache-busting tips
1 parent c040d85 commit 987e5f1

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@ Add to your GitHub profile README:
2020

2121
Replace `your-username` with your GitHub username.
2222

23+
**Note**: GitHub caches images. To see updated counts immediately, add a version parameter:
24+
```markdown
25+
![Profile Views](https://githitbox.duckdns.org/badge/your-username?v=2)
26+
```
27+
2328
### Live Examples:
2429

25-
![Flat](https://githitbox.duckdns.org/badge/octocat?v=1)
26-
![Plastic](https://githitbox.duckdns.org/badge/octocat?style=plastic&v=1)
27-
![Counter](https://githitbox.duckdns.org/badge/octocat?style=counter&v=1)
28-
![For-the-badge](https://githitbox.duckdns.org/badge/octocat?style=for-the-badge&v=1)
30+
![Flat](https://githitbox.duckdns.org/badge/octocat?v=2)
31+
![Plastic](https://githitbox.duckdns.org/badge/octocat?style=plastic&v=2)
32+
![Counter](https://githitbox.duckdns.org/badge/octocat?style=counter&v=2)
33+
![For-the-badge](https://githitbox.duckdns.org/badge/octocat?style=for-the-badge&v=2)
2934

3035
## 🛠️ Local Development
3136

main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,9 @@ async def get_profile_badge(
238238
io.BytesIO(img_bytes.read()),
239239
media_type="image/png",
240240
headers={
241-
"Cache-Control": "public, max-age=60",
241+
"Cache-Control": "no-cache, no-store, must-revalidate",
242+
"Pragma": "no-cache",
243+
"Expires": "0",
242244
"Content-Type": "image/png",
243245
"Access-Control-Allow-Origin": "*",
244246
},

0 commit comments

Comments
 (0)