IndexBackfillSettings class final
The rate at which the persistent cache indexes are filled in the background, see PersistentCacheSettings.indexBackfill.
The fill runs on the queue of the instance: while a run lasts, the other operations of the instance wait. A run costs about 50 to 200 microseconds per document on a cache without many pending writes (more with many pending writes in the collection), so documentsPerRun sets how long the instance can be blocked, and documentsPerRun / interval how fast a new index is complete: with the defaults, an index on 10,000 cached documents takes about 200 minutes of running time.
The official SDKs have a fixed rate (the defaults below); this setting is
specific to this package. To fill the indexes at once, for example while a
loading screen is shown, see PersistentCacheIndexManager.fillIndexes.
final Settings settings = Settings(
cacheSettings: PersistentCacheSettings(
indexAutoCreation: true,
indexBackfill: IndexBackfillSettings(
documentsPerRun: 200,
interval: Duration(seconds: 10),
),
),
);
Constructors
- IndexBackfillSettings({int documentsPerRun = defaultDocumentsPerRun, Duration interval = defaultInterval, Duration initialDelay = defaultInitialDelay})
-
Throws an ArgumentError when
documentsPerRunis not between 1 and maxDocumentsPerRun, whenintervalis shorter than minInterval or longer than maxDelay, or wheninitialDelayis negative or longer than maxDelay.
Properties
- documentsPerRun → int
-
The maximum number of documents that one run indexes, over all
collections. Defaults to 50.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- initialDelay → Duration
-
The delay between the start of the instance and the first run. Defaults
to 15 seconds.
final
- interval → Duration
-
The delay between the end of a run and the start of the next one.
Defaults to one minute.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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
Constants
- defaultDocumentsPerRun → const int
- The number of documents of the official SDKs, 50.
- defaultInitialDelay → const Duration
- The delay before the first run in the official SDKs, 15 seconds.
- defaultInterval → const Duration
- The delay between two runs in the official SDKs, one minute.
- maxDelay → const Duration
- The longest interval and initialDelay, one day.
- maxDocumentsPerRun → const int
- The largest documentsPerRun, 1,000: a run of that size blocks the instance for about 50 to 200 ms on a cache without many pending writes.
- minInterval → const Duration
- The shortest interval, one second.