PersistentCacheSettings

public final class PersistentCacheSettings implements LocalCacheSettings


Configures the SDK to use a persistent cache. Firestore documents and mutations are persisted across App restart.

This is the default cache type unless explicitly specified otherwise.

To use, create an instance using newBuilder, then set the instance to setLocalCacheSettings, and use the built FirebaseFirestoreSettings instance to configure the Firestore SDK.

Summary

Nested types

A Builder for creating PersistentCacheSettings instance.

Public fields

final long

Public methods

boolean
long

Returns cache size threshold for the on-disk data.

int
static @NonNull PersistentCacheSettings.Builder

Returns a new instance of PersistentCacheSettings.Builder with default configurations.

String

Public fields

sizeBytes

public final long sizeBytes

Public methods

equals

public boolean equals(Object o)

getSizeBytes

public long getSizeBytes()

Returns cache size threshold for the on-disk data. If the cache grows beyond this size, Firestore SDK will start removing data that hasn't been recently used. The size is not a guarantee that the cache will stay below that size, only that if the cache exceeds the given size, cleanup will be attempted.

By default, persistent cache is enabled with a cache size of 100 MB. The minimum value is 1 MB.

hashCode

public int hashCode()

newBuilder

public static @NonNull PersistentCacheSettings.Builder newBuilder()

Returns a new instance of PersistentCacheSettings.Builder with default configurations.

toString

public String toString()