CacheProvider<T> class abstract

Low-level interface for a cache.

This can be an in-memory cache, something that writes to disk or to an cache service such as memcached or redis.

The Cache provided by package:neat_cache, is intended to wrap a CacheProvider and provide a more convinient high-level interface.

Implementers of CacheProvider can implement something that stores a value of any type T, but usually implementers should aim to implement CacheProvider<List<int>> which stores binary data.

Implementations of the CacheProvider interface using a remote backing store should throw IntermittentCacheException when an intermittent network issue occurs. The CacheProvider should obviously attempt to reconnect to the remote backing store, but it should not retry operations.

Operations will be retried by Cache, if necessary. Many use-cases of caching are resilient to intermittent failures.




hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


close() Future<void>
Close all connections, causing all future operations to throw.
get(String key) Future<T?>
Fetch data stored under key.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
purge(String key) Future<void>
Clear value stored at key.
set(String key, T value, [Duration? ttl]) Future<void>
Set value stored at key with optional ttl.
toString() String
A string representation of this object.


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