update method

  1. @override
Future<V?> update(
  1. K k
)
override

Force update for a value when a future is registered

Implementation

@override
Future<V?> update(K k) async {
  if(!_futures.containsKey(k)){
    return null;
  }

  final res = await _futures[k]?.call();

  if(res != null){
    _cache[k] = _ManagedItem(
      key: k,
      value: res,
      expireDuration: expireDuration,
      onExpired: _expiredItem,
      reloadDuration: reloadDuration,
      onReload: _reloadItem,
    );

    onReloaded?.call(k);
  }

  return res;
}