Cache class

Laravel-style Cache Facade.

Provides static access to the CacheManager.

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 Methods

fake() FakeCacheManager
Swap the real cache manager with a FakeCacheManager for testing.
flush() Future<void>
Remove all items from the cache.
forget(String key) Future<void>
Remove an item from the cache.
get(String key, {dynamic defaultValue}) → dynamic
Retrieve an item from the cache.
has(String key) bool
Check if an item exists in the cache.
put(String key, dynamic value, {Duration? ttl}) Future<void>
Store an item in the cache.
remember<T>(String key, Duration ttl, Future<T> callback()) Future<T>
Get an item from the cache, or execute the given closure and store the result.
unfake() → void
Restore the real cache manager after faking.