Add startup logging for IOR_CACHE_TTL configuration
Show clear cache TTL settings when Metro starts: - Displays whether cache is disabled (TTL=0) - Shows custom TTL in human-readable format (e.g., 1m 30s) - Shows default TTL when no env variable is set - Includes cache directory location This helps developers understand what cache settings are active.
This commit is contained in:
@@ -41,6 +41,22 @@ const CACHE_TTL = process.env.IOR_CACHE_TTL !== undefined
|
||||
// Use project-local cache directory instead of temp directory to avoid watchman issues
|
||||
const CACHE_DIR = path.join(process.cwd(), '.ior-cache', 'remote');
|
||||
|
||||
// Log cache TTL configuration on startup
|
||||
console.log('[IOR Resolver] Cache TTL Configuration:');
|
||||
if (CACHE_TTL === 0) {
|
||||
console.log('[IOR Resolver] ✓ Cache DISABLED (IOR_CACHE_TTL=0) - Always fetching fresh');
|
||||
} else if (process.env.IOR_CACHE_TTL !== undefined) {
|
||||
const ttlMinutes = Math.floor(CACHE_TTL / 60000);
|
||||
const ttlSeconds = Math.floor((CACHE_TTL % 60000) / 1000);
|
||||
const ttlFormatted = ttlMinutes > 0
|
||||
? `${ttlMinutes}m ${ttlSeconds}s`
|
||||
: `${ttlSeconds}s`;
|
||||
console.log(`[IOR Resolver] ✓ Cache TTL set to ${ttlFormatted} (IOR_CACHE_TTL=${CACHE_TTL}ms)`);
|
||||
} else {
|
||||
console.log('[IOR Resolver] ✓ Cache TTL using default: 1 hour (3600000ms)');
|
||||
}
|
||||
console.log(`[IOR Resolver] ✓ Cache directory: ${CACHE_DIR}`);
|
||||
|
||||
/**
|
||||
* Ensure cache directory exists
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user