aez
aez

Reputation: 2396

Firebase Realtime Database maximum cache size in Android

What is the maximum Firebase Realtime Database cache size for an Android client? Is it limited by Firebase or Android?

Firebase documentation says:

By default, 10MB of previously synced data will be cached. This should be enough for most applications. If the cache outgrows its configured size, the Firebase Realtime Database will purge data that has been used least recently. Data that is kept in sync, will not be purged from the cache

But the final sentence there (with it's oddly placed comma) makes the paragraph unclear to me. Is there a 10MB limit?

Upvotes: 3

Views: 2616

Answers (2)

ademDev
ademDev

Reputation: 1

You can increase it to 100 mb using this code:

FirebaseDatabase.getInstance().setPersistenceCacheSizeBytes(100000000);

Upvotes: 0

Frank van Puffelen
Frank van Puffelen

Reputation: 598718

The limit of 10MB is one that comes from the Firebase SDK.

The last lines refers to data from locations on which you've called ref.keepSynced(true). These locations will not be evicted from the cache.

The write queue (any local write operations that are not yet synchronized with the server) is not part of the 10MB limit.

So it is possible that the persistent cache may require a bit more than 10MB. In general that should be limited though.

Upvotes: 4

Related Questions