Activity Forums Salesforce® Discussions How do we cache server side data on lightning component?

  • shariq

    Member
    September 21, 2018 at 2:03 pm

    Hi,

    The component calls a server method
    The framework checks if the response is available in the cache
    The response is available in the cache and needs to be refreshed (cached response age > refresh age)
    The framework calls the action callback function providing the cached response
    The framework calls the server method to get a fresh response
    The server returns the response
    The framework updates the cache with the new response
    If the server response is different from the cached response, the framework calls the action callback function for the second time with the updated response

    Thanks

  • Parul

    Member
    September 21, 2018 at 4:59 pm

    Adding some points:

    1. Using Server-Side Controller:
    You need to use LIMIT and OFFSET values in SOQL query
    You need to make the server-side call to retrieve the data for every page, which is pretty expensive (will come to this part later**)
    You can never show total page count as you are not fetching the total record at once or you are not sure how many records will be returned
    Better solution if you are dealing with many records as you can fetch n number of records.
    Data loading will be same in almost all the pages

     

    Note**: To make component performance faster, I am using “Action.setStorable()” method, which will cache the data on client side and will improve component performance drastically.

     

    Thanks

     

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos