Cache class

A static class providing methods to interact with the caching system.

Constructors

Cache()

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

cacheDriver BondCache
The cache driver used for caching operations.
getter/setter pair

Static Methods

add<T>(String key, T value, {Duration? expiredAfter}) Future<bool>
Stores a value in the cache with the specified key if the key does not exist.
clear() Future<void>
Clears all cached data in the cache store.
decrement(String key, [int amount = 1]) Future<bool>
Decrements the value stored with the specified key in the cache.
forever<T>(String key, T value) Future<bool>
Stores a value in the cache with the specified key, without an expiration time.
forget(String key) Future<bool>
Removes a value with the specified key from the cache.
get<T>(String key, {dynamic defaultValue, Factory<T>? fromJsonFactory}) → T
Retrieves a value from the cache with the specified key.
getAll<T>(String key, {dynamic defaultValue, Factory<T>? fromJsonFactory}) List<T>
Retrieves a list of cached data associated with the specified key.
has(String key) bool
Checks if a value with the specified key exists in the cache.
increment(String key, [int amount = 1]) Future<bool>
Increments the value stored with the specified key in the cache.
pull<T>(String key, {dynamic defaultValue, Factory<T>? fromJsonFactory}) Future<T>
Retrieves a value from the cache with the specified key, then removes the entry.
put<T>(String key, T value, {Duration? expiredAfter}) Future<bool>
Stores a value in the cache with the specified key.
putAll<T>(String key, List<T> value, {Duration? expiredAfter}) Future<bool>
Stores a list of values in the cache with the specified key.
remember<T>(String key, Duration expiredAfter, Future<T> function()) Future<void>
Stores a value in the cache with the specified key and an expiration time.
rememberForever<T>(String key, Future<T> function()) Future<void>
Stores a value in the cache with the specified key without an expiration time.
store(String storeName) BondCache
Creates and returns a new CacheDriver instance with the specified storeName.
stream<T>(String key) Stream<T>
Returns a Stream that emits values when a specific cache key is updated.
unwatch<T>(String key, [CacheObserver<T>? observer]) → void
Removes an observer for a specific cache key.
watch<T>(String key, CacheObserver<T> observer) → void
Adds an observer for a specific cache key.