keyValueCacheSettings function

KeyValueCacheSettings keyValueCacheSettings({
  1. required CacheStore store,
  2. int sizeBytes = Settings.defaultCacheSizeBytes,
  3. bool indexAutoCreation = false,
  4. IndexBackfillSettings? indexBackfill,
  5. bool mergeUnsentWrites = false,
})

Settings for a persistent cache in store, a key-value store the app brings (see KeyValueCacheSettings and CacheStore).

sizeBytes is an approximate cache size threshold, as in PersistentCacheSettings.sizeBytes: the size is that of the cached documents as the SDK writes them to the store. Use Settings.cacheSizeUnlimited to disable the collection; the minimum is 1 MB, an ArgumentError is thrown otherwise. indexAutoCreation, indexBackfill and mergeUnsentWrites are those of PersistentCacheSettings.

The store holds the cache of one instance at a time: an instance whose store is the cache of another instance that is still running fails to start.

Implementation

KeyValueCacheSettings keyValueCacheSettings({
  required CacheStore store,
  int sizeBytes = Settings.defaultCacheSizeBytes,
  bool indexAutoCreation = false,
  IndexBackfillSettings? indexBackfill,
  bool mergeUnsentWrites = false,
}) => KeyValueCacheSettingsInternal.create(
  store,
  CacheStorePersistence.factoryFor(store),
  sizeBytes: sizeBytes,
  indexAutoCreation: indexAutoCreation,
  indexBackfill: indexBackfill,
  mergeUnsentWrites: mergeUnsentWrites,
);