Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How large is AsyncStorage in React Native?

Tags:

react-native

The documentation says it should be used instead of LocalStorage, but it doesn't list anything regarding how large it is. If I recall, LocalStorage in web browsers is only about 10mb.

https://facebook.github.io/react-native/docs/asyncstorage.html

like image 632
Ryan McDermott Avatar asked Sep 30 '15 21:09

Ryan McDermott


People also ask

How much can you store in AsyncStorage?

Motivation​ Current Async Storage's size is set to 6MB. Going over this limit causes database or disk is full error. This 6MB limit is a sane limit to protect the user from the app storing too much data in the database.

How much data can be store in AsyncStorage in React Native?

Note that on Android AsyncStorage has an upper size limit of 6MB.

What is AsyncStorage React Native?

AsyncStorage is an unencrypted, asynchronous, persistent, key-value storage system that is global to the app. It should be used instead of LocalStorage. It is recommended that you use an abstraction on top of AsyncStorage instead of AsyncStorage directly for anything more than light usage since it operates globally.

How fast is AsyncStorage?

AsyncStorage takes about 12x more time to read/write on average compared to localStorage. This article introduces a few techniques to optimize AsyncStorage so that it could be improved such that it could be used in production.


2 Answers

It writes to disk and is very large if there is free space. On iOS there are no artificial caps other than what the underlying operating system imposes: https://stackoverflow.com/a/1897383/454967.

like image 188
ide Avatar answered Sep 23 '22 08:09

ide


The new way of increasing AsyncStorage size on react-native is to add AsyncStorage_db_size_in_MB= property to your android/gradle.properties as shown here: https://react-native-async-storage.github.io/async-storage/docs/advanced/db_size/

like image 25
Justin Lok Avatar answered Sep 24 '22 08:09

Justin Lok