HHive class
Main HiveHook API for interacting with the database. Provides CRUD operations with hook support and metadata management.
Constructors
- HHive({HHImmutableConfig? config, String? env})
-
Creates or retrieves an HHive instance for the given environment.
Either
configorenvmust be provided.factory
Properties
- config → HHImmutableConfig
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
{Map< String, dynamic> ? meta}) → Future<void> - Clears all data and metadata for this environment.
-
delete(
String key, {Map< String, dynamic> ? meta}) → Future<void> - Deletes a value and its metadata by key.
-
entries(
) → Stream< MapEntry< String, dynamic> > - Returns a stream of all key-value entries. Bypasses hooks for performance.
-
get(
String key, {Map< String, dynamic> ? meta}) → Future - Retrieves a value by key.
-
getMeta(
String key, {Map< String, dynamic> ? meta}) → Future<Map< String, dynamic> ?> - Retrieves metadata for a key.
-
ifNotCached(
String key, Future computeValue(), {Map< String, dynamic> ? meta, bool cacheOnNullValues = false}) → Future - Gets cached value or computes and caches it if not found.
-
keys(
) → Stream< String> - Returns a stream of all keys. Bypasses hooks for performance.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pop(
String key, {Map< String, dynamic> ? meta}) → Future - Gets and deletes a value in one operation.
-
put(
String key, dynamic value, {Map< String, dynamic> ? meta}) → Future<void> - Stores a value with optional metadata.
-
putMeta(
String key, Map< String, dynamic> metadata, {Map<String, dynamic> ? meta}) → Future<void> - Stores metadata for a key.
-
toString(
) → String -
A string representation of this object.
inherited
-
values(
) → Stream - Returns a stream of all values. Bypasses hooks for performance.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
dispose(
HHPayloadI payload, {bool clear = true}) → Future< void> -
Disposes an environment and optionally clears its data.
Set
clearto false to keep data after disposal. -
ifNotCachedStatic(
HHPayloadI payload, Future computeValue(), {bool cacheOnNullValues = false}) → Future -
Gets cached value or computes and caches it if not found.
Set
cacheOnNullValuesto control whether null results are cached. -
staticClear(
HHPayloadI payload) → Future< void> - Clears all data and metadata for the given environment. Triggers onClear hooks.
-
staticClearAll(
{List< String> exemptList = const []}) → Future<void> -
Clears all data across all environments.
Use
exemptListto specify regex patterns for environments to skip. -
staticDelete(
HHPayloadI payload) → Future< void> - Deletes a value and its metadata by key. Triggers onDelete hooks.
-
staticEntries(
HHPayloadI payload) → Stream< MapEntry< String, dynamic> > - Returns a stream of all key-value entries. Bypasses hooks for performance.
-
staticGet(
HHPayloadI payload) → Future - Retrieves a value by key. Triggers valueRead hooks.
-
staticGetMeta(
HHPayloadI payload) → Future< Map< String, dynamic> ?> - Retrieves metadata for a key. Triggers metadataRead hooks.
-
staticKeys(
HHPayloadI payload) → Stream< String> - Returns a stream of all keys. Bypasses hooks for performance.
-
staticPop(
HHPayloadI payload) → Future - Gets and deletes a value in one operation. Returns the value before deletion.
-
staticPut(
HHPayloadI payload) → Future< void> - Stores a value with optional metadata. Triggers valueWrite hooks.
-
staticPutMeta(
HHPayloadI payload) → Future< void> - Stores metadata for a key. Triggers metadataWrite hooks.
-
staticValues(
HHPayloadI payload) → Stream - Returns a stream of all values. Bypasses hooks for performance.