Hello Lightning Experts,
How to implement custom caching in Client Side for Lightning. Is HTML 5 Web Storage is right option for this?
Use Case: Based on the service address, show the service partner details, allow user to select partner. After the selection of the partner navigate the user to next screen and allow him to Time Slot.
Current Design: 1) we have developed a custom lightning component, Once the user enters the service address call the external system to retrieve partner details and time slots. 2) External System will provide around 15-25 partners List of data and each partner will have 5-15 time slots in the below format.
Below is just a sample format.
{
"partners": [
{ "name":"p1", "models":[ "10AM-11AM", "12PM-1PM", "1AM- 3AM" ] },
{ "name":"p2", "models":[ "10AM-11AM"] },
{ "name":"p3", "models":[ "10AM-12PM", "1AM- 3AM" ] }
]
}
3) Once we receive the response from external system. we are creating records on a custom object for each time slot as a record it will be around 50-100 records.
4) after record creation, we are returning partners list to Client side and showing the users the partner list.
5) after user selecting partner from the list. we are navigating the user to the next screen and we are doing SOQL query and retrieving the time slots and showing to user to select.
6) Once the users selects the slots we are deleting the records from the custom object.
With the current design users are experiencing performance issues. Since records on the custom object are deleted and inserted synchronously.
As we are looking for the alternate approach to cache the data from external system in client. please suggest the best possible approaches.