Implement a simple caching system using static variables. Create methods to manage cache operations: cacheGet() to retrieve/store values, cacheContainsKey() to check cache contents, and clearCache() to reset the cache. The expensive operation is simulated by converting the key to uppercase and appending '-processed'.
Examples
Input: Cache.get('user1')
Output: 'USER1-processed'
Explanation: Key not in cache, performs expensive operation and stores result.
Input: Cache.get('user1') (called again)
Output: 'USER1-processed'
Explanation: Key found in cache, returns cached value without recalculation.
Input: Cache.get('data')
Output: 'DATA-processed'
Explanation: Different key, performs expensive operation and stores result.
Apex Code Editor
Welcome to Lightning Challenge!
How It Works
- • Write your solution in the code editor
- • Connect your Salesforce org to test
- • Submit to check if your solution passes
- • Use hints if you get stuck
Contest Alert
🏆 #CodeEveryDay July 2026
Contest runs July 1 - 31. Complete challenges to climb the leaderboard!
Only the 31 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.