PVCacheTop class
Global access for PVCache without explicit instance reference.
Provides singleton-like interface using the most recently created cache.
Usage:
final cache = PVCache(env: 'myCache', hooks: [], defaultMetadata: {});
await PVCacheTop.put('key', 'value');
final value = await PVCacheTop.get('key');
Constructors
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- currentEnv ↔ String?
-
Current environment name. If null, uses most recent cache.
getter/setter pair
Static Methods
-
clear(
{Map< String, dynamic> ? metadata}) → Future<void> - Clear all cache entries.
-
delete(
String key, {Map< String, dynamic> ? metadata}) → Future<void> - Delete key-value pair from cache.
-
exists(
String key, {Map< String, dynamic> ? metadata}) → Future<bool> - Check if key exists in cache (respects TTL).
-
get(
String key, {Map< String, dynamic> ? metadata}) → Future - Retrieve value from cache. Returns null if not found.
-
put(
String key, dynamic value, {Map< String, dynamic> ? metadata}) → Future<void> - Store key-value pair in cache.