add method

V? add(
  1. K key,
  2. V value
)

Add new key and value entry to the cache.

Implementation

V? add(K key, V value) => _cache
    .update(
      key,
      (CacheEntry<V> oldValue) => CacheEntry<V>(value, ttl: ttl),
      ifAbsent: () => CacheEntry<V>(value, ttl: ttl),
    )
    .data;