This question evaluates a candidate's competency in designing and analyzing in-memory cache/hash map optimizations, covering cache key/value selection, eviction policy and invalidation strategies, concurrency safety, and time and space complexity before and after caching.
Propose and analyze an optimization that uses an in-memory cache/dictionary/hash map to speed up repeated lookups in the script (e.g., mapping file paths or parsed license strings to computed results). Specify cache keys and values, eviction policy (LRU/LFU/TTL), and invalidation when the underlying file changes (mtime/hash). Discuss concurrency safety if multiple processes/threads may run; provide pseudocode for get/put with validation; and state expected time and space complexity before and after introducing the cache.