Search code examples
single-page-applicationbrowser-cache

Whats the best way to cache Playlists in Single Page Apps


If Spotify is implemented as a SPA, what is the best way to cache User Playlists

  • Should I fully load all the User's playlists (songs that are part of it) once the user is authenticated, and appropriately show if the item is part of any his playlist when User tries to add/edit an item to playlist.

  • I could instead just load Users playlists and invoke if it belongs to the any them in real time when user tries to edit.

I cannot really see how many playlists typical user creates and how it affects the performance of the app (slow load times, mobile browsers etc) vs checking each and every time whether a particular items exists in playlist by invoking a request to server side api.

any ideas.


Solution

  • I will start loading all Playlists and content, considering these are just list of numbers, shouldn't be holding too much memory.

    If it becomes an issue option 2 is always there.