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!
Create an Account
Sign up to track your progress, earn points, and compete with others. Your solutions will be saved automatically.
Create accountHow 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 Feb 2026
Contest runs February 1 - 28. Complete challenges to climb the leaderboard!
Points are calculated for challenges completed during the contest period.