I’m working on a react native app where I have my firebase database storing an inventory of about 10000 items. So I need to store that data locally and I was thinking of saving each item into his own key with async storage. Is that okay or is there a more efficient way?
Because asyncStorage is unencrypted, the stored data is not converted into code or encrypted to prevent unauthorized access, meaning anyone with your device can easily get to the data. However, since it is unencrypted, getting or retrieving data from the asyncStorage is easier and does not involve any further decryption.
On Android, AsyncStorage will use either RocksDB or SQLite based on what is available. The AsyncStorage JavaScript code is a facade that provides a clear JavaScript API, real Error objects, and non-multi functions.
On iOS devices, the AsyncStorage is not limited programmatically. On Android devices, the current AsyncStorage size is set to 6MB by default. Reaching this limit is going to result in errors like database or disk is full. There are valid reasons why this limit exists but if there is a need to increase the size, you can do that.
Let us start creating the demo application which is going to save a value from the user's input in the storage and fetch the value from the storage. This reading and writing of data are going to be done with the help of AsyncStorage API functions. Open the App.js file and start by importing the following components.
AsyncStorage has slow runtime and has no indexing capabilities. Because AsyncStorage only accepts string as its value, all data must first be serialized into string before being inserted, and deserialized once retrieved. This is why you should not use AsyncStorage when dealing with a large amount of data
you can read this article for more information on how AsyncStorage works while dealing with large data: https://codeburst.io/tackling-react-native-storage-part-1-d27b2bfa480f
You can use AsyncStorage, it will always take a time when you try to retrieve the data from it.
There are other possible way like:
1) React Native SQLite 2
2) React Native Storage
3) Realm
4) React Native Local MongoDB
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With