QueryCache class

Manages in-memory and persistent caching for queries.

This class uses Hive for persistent storage.

IMPORTANT: For custom types (e.g., DoctorEntity), you MUST register a TypeAdapter for them with Hive before initializing the cache. Example: Hive.registerAdapter(DoctorEntityAdapter());

Properties

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() Future<void>
Clears all data from both in-memory and persistent cache.
dispose() Future<void>
Disposes the persistent cache. Should be called on app shutdown.
get<T>(String key) Future<T?>
Retrieves data from cache, checking memory first, then persistent storage.
has(String key) bool
Checks if the cache contains data for a given key.
initialize() Future<void>
Initializes the QueryCache.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(String key) Future<void>
Removes data from both in-memory and persistent cache.
set<T>(String key, T data, {Duration? ttl}) Future<void>
Stores data in both in-memory and persistent cache.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance QueryCache
Provides a singleton instance of QueryCache.
no setter