Document IOR_CACHE_TTL environment variable

- Added documentation for cache TTL configuration
- Included usage examples for development scenarios
- Added cache management section with practical examples
This commit is contained in:
Chris Daßler
2025-08-29 12:47:23 +02:00
parent 252416d30c
commit 1f9a177d4c

View File

@@ -212,6 +212,10 @@ Pre-fetches a remote component for faster access.
- `DEBUG=true` - Enable debug logging for the Node.js loader - `DEBUG=true` - Enable debug logging for the Node.js loader
- `NODE_ENV=development` - Enable hot reload for Metro resolver - `NODE_ENV=development` - Enable hot reload for Metro resolver
- `IOR_CACHE_TTL` - Control cache duration in milliseconds
- `IOR_CACHE_TTL=0` - Disable caching (always fetch fresh)
- `IOR_CACHE_TTL=60000` - 1 minute cache (useful during development)
- Default: 3600000 (1 hour)
### Cache Configuration ### Cache Configuration
@@ -219,12 +223,34 @@ The resolver uses different cache locations for different environments:
- **Metro**: `.ior-cache/remote/` in project root - **Metro**: `.ior-cache/remote/` in project root
- **Node.js**: OS temp directory under `metatrom-components/remote/` - **Node.js**: OS temp directory under `metatrom-components/remote/`
- **Default TTL**: 1 hour (3600000ms) - **Default TTL**: 1 hour (3600000ms) - configurable via `IOR_CACHE_TTL`
### Cache Persistence ### Cache Persistence
Metro resolver maintains a persistent cache mapping in `.ior-cache/mappings.json` for faster startup times. Metro resolver maintains a persistent cache mapping in `.ior-cache/mappings.json` for faster startup times.
### Cache Management During Development
When working with frequently changing remote components:
```bash
# Disable cache completely (always fetch fresh)
IOR_CACHE_TTL=0 npm start
# Use short cache duration (1 minute)
IOR_CACHE_TTL=60000 npm start
# Clear cache manually
rm -rf .ior-cache/remote/*
# Or add to package.json scripts:
"scripts": {
"dev:no-cache": "IOR_CACHE_TTL=0 npm start",
"dev:short-cache": "IOR_CACHE_TTL=60000 npm start",
"clear-cache": "rm -rf .ior-cache/remote/*"
}
```
## Architecture ## Architecture
The package is designed with a shared core architecture: The package is designed with a shared core architecture: