From 1f9a177d4c106162cb79dbeba3a7f8f5827fe5e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20Da=C3=9Fler?= Date: Fri, 29 Aug 2025 12:47:23 +0200 Subject: [PATCH] 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 --- README.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6037b1c..0739853 100644 --- a/README.md +++ b/README.md @@ -212,6 +212,10 @@ Pre-fetches a remote component for faster access. - `DEBUG=true` - Enable debug logging for the Node.js loader - `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 @@ -219,12 +223,34 @@ The resolver uses different cache locations for different environments: - **Metro**: `.ior-cache/remote/` in project root - **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 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 The package is designed with a shared core architecture: