Skip to content

Add file-based cache for API calls with configurable TTL#6

Merged
paulund merged 1 commit into
mainfrom
add-file-cache
May 26, 2026
Merged

Add file-based cache for API calls with configurable TTL#6
paulund merged 1 commit into
mainfrom
add-file-cache

Conversation

@paulund
Copy link
Copy Markdown
Owner

@paulund paulund commented May 26, 2026

Adds a lightweight cache to metals.dev API calls so you hit the API at most once per day (or configurable interval), drastically reducing usage against the free tier's 100-request/month limit.

Changes

  • src/cache.ts — file-based cache manager (~/.cache/goldcli/)
  • src/metals-api.ts — cache integration with TTL checks and incremental timeseries fetching
  • src/prices.ts — threads refresh param through
  • src/index.ts — new --refresh / -f CLI flag
  • CONTEXT.md — project glossary with cache terms
  • .env.example — documented CACHE_MAX_AGE_HOURS

@paulund paulund merged commit 00899a2 into main May 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant