Skip to content

Cache Domain

magmacrunchmedia edited this page Aug 9, 2026 · 2 revisions

Cache Domain

File-based cache with TTL expiration for faster repeated queries.

Commands

Show cache statistics

magmascript cache stats

Output:

total_files  total_size_bytes  domains                                     enabled  hits  misses  sets  hit_rate
-----------  ----------------  ------------------------------------------  -------  ----  ------  ----  --------
3            12456             {'media': {'files': 1, 'size_bytes': 3259}} True     5     2       3     71.4%

Clear all cache

magmascript cache clear

Clear specific domain

magmascript cache clear --domain media
magmascript cache clear --domain scores
magmascript cache clear --domain gh

What's Cached

Domain TTL What
Media 24h Full search results (all 6 providers)
Scores 1h Score file reads from Pi
GitHub 5min Workflow runs (rate limit protection)

Skip Cache

magmascript media search "art" --no-cache
magmascript scores list --no-cache
magmascript gh workflows --no-cache

Configuration

[cache]
enabled = true
ttl_media = 86400    # 24h
ttl_scores = 3600    # 1h
ttl_gh = 300         # 5min

Or disable entirely:

export MAGMA_CACHE_DISABLED=1

Storage

Cache files are stored in ~/.cache/magmascript/{domain}/:

~/.cache/magmascript/
├── media/
│   └── {hash}.json    # keyed by query+source+page+filters
├── scores/
│   └── {game_id}.json # keyed by game
└── gh/
    └── workflows.json # single file, TTL-based

Clone this wiki locally