MemoryLruGcSettings

public final class MemoryLruGcSettings implements MemoryGarbageCollectorSettings


Configures the SDK to use a Least-Recently-Used garbage collector for memory cache.

To use, create an instance using MemoryLruGcSettings#newBuilder().build(), then set the instance to MemoryCacheSettings.Builder#setGcSettings, and use the built MemoryCacheSettings instance to configure the Firestore SDK.

Summary

Nested types

Public fields

long

Public methods

boolean
long

Returns cache size threshold for the memory cache.

int
static @NonNull MemoryLruGcSettings.Builder

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

@NonNull String

Public fields

sizeBytes

public long sizeBytes

Public methods

equals

public boolean equals(Object o)

getSizeBytes

public long getSizeBytes()

Returns cache size threshold for the memory cache. 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, memory LRU cache is enabled with a cache size of 100MB (100 * 1024 * 1024). The minimum value is 1 MB (1024 * 1024).

hashCode

public int hashCode()

newBuilder

public static @NonNull MemoryLruGcSettings.Builder newBuilder()

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

toString

public @NonNull String toString()