Questions About Loading and Managing A Local Copy of A Database Table

So I’d like to store and manage a database table’s contents localIy in order to minimise the amount of hits on the server.

I want to be able to:

  • Load up the database content to the local store
  • Use a name search on a repeat block to search items in the local copy (so there isn’t a database hit each time the name search is done)
  • Add/Remove/Edit an item in the database table and in parallel perform the same operation on the local copy so it is in sync with the database table - without needing to re-load the entire table each time this happens.

It would seem there are potentially 3 ways to do this

  1. Load the database table and cache it
    (-) At the moment I’m struggling to make cached data reload (see previous post)
    (+) This would work well to prevent the database hits during the search
    (-) Would involve re-loading the whole table when I add/remove/edit an item - not necessarily the end of the world.
    (+) Don’t need to define any data structure locally and match it to the database table - this is all done for me.

  2. Define an Array and Local Storage
    (?) QUESTION - I can’t see a way to pre-load the local storage based array with the database table… the Value field of the array is taken up linking it to the Local Storage Manager! Can such a structure be loaded with the contents of a database table?

  3. Use New Data Store
    (?) QUESTION - I can’t see a way to pre-load a Data Store with a database table’s fields… is that possible now, or do I need to wait for the new loop functionality that @George has mentioned?

  4. QUESTION - is there another method I haven’t thought of…?

Data Security
The other question in this is data security. So if the data needs to be secure and is stored in the browser’s local storage, then it is potentially visible once the user has logged out.

QUESTION - is there a way to store it locally which is more RAM than hard drive based? Would that potentially be Session storage (which if I understand correctly, is cleared once the browser is closed).

Thanks in anticipation of any feedback you have!

Best wishes,
Antony.

1 Like

Hi mate,

Have you thought about using the data view component on which you can do name search (filter), sort, apply paging? - Displaying Record Details with the Data View Component

For a backend to front-end push, I think it has to be either be a real-time database (or) has to come via socket!

Session get’s cleared when the browser is closed, while Local storage persists until cleared by the user via js, dynamic event, browser cache clearing.