persistenceEnabled property

bool get persistenceEnabled

Whether data written now survives a restart.

It reports what was asked for (a non-null persistence) until the store is open, then whether the store is durable. It is false when the store could not be opened (its opener threw), and when another owner holds the cache file (after waiting one lease period the instance runs memory only and logs one warning), and it turns false if the store fails or is fenced later in the session.

Implementation

bool get persistenceEnabled {
  if (_persistence == null || _openFailed) {
    return false;
  }
  return _engine?.isDurable ?? true;
}