-
Browse Mods (Paginated)
- Fetches ALL mods in batches of 100
- Example: 347 mods = 4 API calls
- Cached for 10 minutes
-
Search Mods
- 1 API call per search query
- Cached for 10 minutes
-
Download Mod
- 1 download per mod (NOT counted against API rate limits usually)
- Downloads are direct file transfers
-
Update Check
- Runs ONCE on startup only
- Not repeated during session
✅ Aggressive 10-minute caching
- Browse results cached
- Search results cached
- Same query = 0 new API calls
✅ Startup-only update checks
- Checks once when app opens
- NOT on every refresh
✅ Pagination with caching
- Loads all mods once
- Subsequent views = 0 API calls
✅ Download doesn't use rate limits
- File downloads are separate from API calls
- mod.io doesn't count downloads against limits
Without Caching (OLD):
- Open app: 1 call
- Browse: 1 call
- Sort: 1 call (new)
- Sort again: 1 call (new)
- Search: 1 call
- Refresh: 1 call
- Browse again: 1 call
- Check updates: 1 call
Total: ~8-10 calls
With Current Caching (NEW):
- Open app: 4 calls (paginated load of 347 mods)
- Browse: 0 calls (cached)
- Sort: 0 calls (cached)
- Sort again: 0 calls (cached)
- Search: 1 call (first time)
- Same search: 0 calls (cached)
- Refresh: 4 calls (forced refresh)
- Browse: 0 calls (cached)
- Check updates: 0 calls (only on startup)
Total: 5-9 calls (depends on usage)
According to mod.io documentation:
- Rate limit: 100 requests per hour per IP
- Download bandwidth: Unlimited
- API key: Not tied to specific quotas
- First session: 4-5 calls (load all mods)
- Same session: 0-1 calls (everything cached)
- Well under 100/hour ✓
Current: 10 minutes Possible: 30 minutes or 1 hour
Pros:
- Fewer API calls
- Faster app
Cons:
- Users see older data
- New mods don't appear quickly
Recommendation: Keep 10 minutes (good balance)
What it means:
- Save mod list to disk when closing app
- Load from disk on startup
- Only fetch updates when user clicks refresh
Pros:
- 0 API calls on startup (loads from disk)
- Instant startup
- Work offline (browse cached mods)
Cons:
- Data can be outdated
- More complex code
- Disk space usage (~1-2 MB)
Recommendation: Could implement if API usage is a concern
What it means:
- Only re-fetch if cache is older than X minutes
- Show "Last updated: 5 mins ago" in status bar
- Let user decide when to refresh
Current: Auto-refreshes every 10 mins Smart: Manual refresh only
Recommendation: Already somewhat implemented (F5 forces refresh)
Good news: You're already optimized! Current usage is:
- ✅ ~5-10 API calls per session
- ✅ Far below 100/hour limit
- ✅ 90%+ reduction from initial design
Option: Increase cache to 30 minutes
# Change line 744:
self.CACHE_DURATION = 1800 # 30 minutes instead of 600Result:
- Cache lasts longer
- Fewer automatic refreshes
- 2-3 calls per session instead of 5-10
Actions:
- Open app (4 calls - initial load)
- Search "building" (1 call)
- Browse results (0 calls - cached)
- Install 5 mods (0 API calls - downloads don't count)
- Sort by rating (0 calls - cached)
- Search "harbor" (1 call)
- After 15 mins, browse again (4 calls - cache expired)
- Check conflicts (0 calls - local operation)
- Enable all mods (0 calls - local operation)
Total: ~10 API calls in 2 hours Rate: 5 calls/hour Limit: 100 calls/hour Usage: 5% of limit ✓
✅ Downloading mods - Direct file transfer ✅ Local operations - Enable, disable, load order, conflicts ✅ Cached requests - No new API call made ✅ UI interactions - Sorting, filtering cached data
❌ First browse - Paginated fetches ❌ New searches - Each unique query ❌ Manual refresh (F5) - Forces new fetch ❌ Update checks - Once per startup only
You're already extremely optimized!
- Current usage: ~5-10 calls per session
- API limit: 100 calls per hour
- Your usage: 5-10% of limit
You could:
- Use the app 10-20 times per hour and still be safe
- Keep it open all day without issues
- Download hundreds of mods without hitting limits
No further optimization needed unless you want to work offline!
If you want to implement persistent caching for offline use, I can add:
- Save cache to disk on close
- Load from disk on startup
- "Last updated" timestamp
- Manual refresh button only
This would give you:
- 0 API calls on startup
- Work completely offline after first load
- ~2 API calls per hour (only when manually refreshing)
Let me know if you want this!