GenericVault<T> constructor
GenericVault<T> (
- Store<
VaultInfo, VaultEntry> storage, { - VaultManager? manager,
- String? name,
- VaultLoader<
T> ? vaultLoader, - Clock? clock,
- EventListenerMode? eventListenerMode,
- bool? statsEnabled,
- VaultStats? stats,
Builds a GenericVault out of a mandatory Store and a set of optional configurations
storage
: The Storemanager
: An optional VaultManagername
: The name of the vaultvaultLoader
: The VaultLoader, that should be used to fetch a new value upon absenceclock
: The source of time to be used on this, defaults to the system clock if not providedstatsEnabled
: If statistics should be collected, defaults to falsestats
: The statistics instance, defaults toDefaultVaultStats
Returns a GenericVault
Implementation
GenericVault(this.storage,
{this.manager,
String? name,
VaultLoader<T>? vaultLoader,
Clock? clock,
EventListenerMode? eventListenerMode,
bool? statsEnabled,
VaultStats? stats})
: name = name ?? Uuid().v1(),
vaultLoader = vaultLoader ?? ((key) => Future<T?>.value()),
clock = clock ?? Clock(),
eventPublishingMode = eventListenerMode ?? EventListenerMode.disabled,
streamController = StreamController.broadcast(
sync: eventListenerMode == EventListenerMode.synchronous),
statsEnabled = statsEnabled ?? false,
stats = stats ?? DefaultVaultStats();