PersistentCacheSettings class final
Configures a cache stored on disk (the default). The on disk cache is garbage collected once it exceeds sizeBytes.
The cache is stored in the SQLite database that the openDatabase function of FirebaseFirestore.instanceFor opens
(a file on the VM, IndexedDB or OPFS on the web). Without that function the instance falls back to a memory
cache. The data and the pending writes survive a restart of the program.
final Settings settings = Settings(
cacheSettings: PersistentCacheSettings(
sizeBytes: Settings.cacheSizeUnlimited,
),
);
- Inheritance
-
- Object
- LocalCacheSettings
- PersistentCacheSettings
Constructors
- PersistentCacheSettings({int sizeBytes = Settings.defaultCacheSizeBytes, bool indexAutoCreation = false, IndexBackfillSettings? indexBackfill, bool mergeUnsentWrites = false})
-
sizeBytesis an approximate cache size threshold: if the cache grows beyond it, Firestore starts removing data that has not been recently used. Use Settings.cacheSizeUnlimited to disable the collection. The minimum is 1 MB, an ArgumentError is thrown otherwise.
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- indexAutoCreation → bool
-
Whether the automatic creation of persistent cache indexes is on from the
start of the instance, as if
PersistentCacheIndexManager.enableIndexAutoCreationhad been called before the first query. Defaults to false.final - indexBackfill → IndexBackfillSettings
-
How fast the persistent cache indexes are filled in the background. The
default is the fixed rate of the official SDKs.
final
- mergeUnsentWrites → bool
-
Not in the official SDKs: a supported opt-in extension that differs from them in what the backend sees (see
"What the app gives up" below). Whether a write to a document whose previous write is still pending and was not
sent yet replaces that write with one merged write, instead of queuing a second one. Off by default; when off
nothing changes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sizeBytes → int
-
The cache size threshold, in bytes.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override