add method

  1. @override
bool add(
  1. K k,
  2. V v
)
override

Add value in cache only it the element doesn't exist Returns true when element is added otherwise false

Implementation

@override
bool add(K k, V v) {
  if (_cache.containsKey(k)) {
    return false;
  }

  _cache[k] = _ManagedItem(
    key: k,
    value: v,
    expireDuration: expireDuration,
    onExpired: _expiredItem,
    reloadDuration: reloadDuration,
    onReload: _reloadItem,
  );

  return true;
}