Activity Forums Salesforce® Discussions What is the purpose of using (cacheable=true) annotation in Apex salesforce?

  • What is the purpose of using (cacheable=true) annotation in Apex salesforce?

    Posted by Anuj on June 29, 2020 at 11:06 am

    What is the purpose of using (cacheable=true) annotation in Apex salesforce?

    MOHIT replied 4 years, 4 months ago 2 Members · 1 Reply
  • 1 Reply
  • MOHIT

    Member
    June 29, 2020 at 3:01 pm

    To improve runtime performance, set @AuraEnabled(cacheable=true) to cache the method results on the client. To set cacheable=true, a method must only get data. It can’t mutate data.
    Marking a method as storable (cacheable) improves your component’s performance by quickly showing cached data from client-side storage without waiting for a server trip. If the cached data is stale, the framework retrieves the latest data from the server. Caching is especially beneficial for users on high latency, slow, or unreliable connections such as 3G networks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos