Salesforce Certified Platform Developer II — Question 23

A developer wishes to improve runtime performance of Apex calls by caching results on the client.
What is the best way to implement this?

Answer options

Correct answer: A

Explanation

The correct answer is A because using @AuraEnabled(cacheable=true) allows the results of the Apex call to be cached on the client, improving performance. Option B is incorrect as setting a cookie does not provide the same caching benefits for Apex calls. Option C is also incorrect because setStorable() is not used in the context of caching Apex results, and option D is wrong as there is no @AuraEnabled(storable=true) annotation; the correct annotation is cacheable.