Do even less to "fix" `invalidate`. Return `Null`, which is awaitable.
diff --git a/lib/src/async_cache.dart b/lib/src/async_cache.dart
index c2d7c01..36dec01 100644
--- a/lib/src/async_cache.dart
+++ b/lib/src/async_cache.dart
@@ -37,13 +37,6 @@
/// Fires when the cache should be considered stale.
Timer _stale;
- /// Creates a cache that invalidates after an in-flight request is complete.
- ///
- /// An ephemeral cache guarantees that a callback function will only be
- /// executed at most once concurrently. This is useful for requests for which
- /// data is updated frequently but stale data is acceptable.
- factory AsyncCache.ephemeral() => new AsyncCache(Duration.zero);
-
/// Creates a cache that invalidates its contents after [duration] has passed.
///
/// The [duration] starts counting after the Future returned by [fetch]
@@ -51,6 +44,13 @@
/// event.
AsyncCache(this._duration);
+ /// Creates a cache that invalidates after an in-flight request is complete.
+ ///
+ /// An ephemeral cache guarantees that a callback function will only be
+ /// executed at most once concurrently. This is useful for requests for which
+ /// data is updated frequently but stale data is acceptable.
+ factory AsyncCache.ephemeral() => new AsyncCache(Duration.zero);
+
/// Returns a cached value from a previous call to [fetch], or runs [callback]
/// to compute a new one.
///
@@ -89,13 +89,16 @@
}
/// Removes any cached value.
- Future invalidate() {
+ Null invalidate() {
_cachedValueFuture = null;
- Future invalidate = _cachedStreamSplitter?.close();
+ // TODO: This does not await, but probably should.
+ _cachedStreamSplitter?.close();
_cachedStreamSplitter = null;
_stale?.cancel();
_stale = null;
- return invalidate;
+
+ // TODO: This does not return a future, but probably should.
+ return null;
}
void _startStaleTimer() {