What is the most efficient way to update data in Ionic local storage?

I have an Ionic 5 App that relies heavily on Ionic local storage, a lot of the data needs to be available offline, this data can then be read and updated within the App, then saved in Ionic local storage and also sent back to the server using an API (although this part is irrelevant to this problem).

The data (in this case the “items”) often contain images that are stored as Base64, therefore making the size of data and the resulting JSON string quite large.

I seem to have issues with some users where the Ionic app can crash and restart on iOS which I believe is because of the amount of data being read into memory from local storage.

Currently, the “items” are stored in local storage using the following code:

this.storage.set('items', items);

Then when a single item needs to be updated I have to do something like the following:

  setItem(itemId, item: Item) {

    return this.getItems().pipe(
      map((items: any[]) => {

        // Find by itemID
        let index = items.findIndex((i) => i.ItemId === itemId);

        // If cannot find item then add it to array, otherwise update it in the array
        if (index === -1) {
          items.push(item);
        } else {
          items[index] = item;
        }

        // Update items in local storage
        this.storage.set('items', items);

        return item;
      })
    );
  }

  // Get items from local storage
  getItems(): Observable<Item[]> {
    return from(this.storage.ready().then(() => {
      return this.storage.get('items').then((items) => {
        return items;
      });
    }));
  }

Having come from a SQL Server background this seems very inefficient having to load all “items” into memory and out of the database just to update one of them and I can understand why the App might crash if there is a large amount of data being pulled into memory.

Is there a better way to be doing this? I have seen Ionic offer something called “Ionic Offline Storage” but there is very little information on this and I guess it must be something you have to pay for and likely expensive as they do not show any pricing for this on their website, just a form where you have to contact them for more details (I always get suspicious when companies do this).

To be honest I do not mind paying for a solution if there is a better one available and the cost is reasonable. Does anyone have any better solutions for doing something like this, is there a way to use Ionic storage without loading everything into memory each time you want to update one item or another local database solution that can be used which handles this more efficiently?