get abstract method

Future<T?> get([
  1. Future<T?> create(),
  2. Duration ttl
])

Get value stored in this cache entry.

If used without create, this function simply gets the value or null if no value is stored.

If used with create, this function becomes an upsert, returning the value stored if any, otherwise creating a new value and storing it with optional ttl. If multiple callers are using the same cache this is an inherently racy operation, that is multiple instances of the value may be created.

The get method is a best-effort method. In case of intermittent failures from the underlying CacheProvider the get method will ignore failures and return null (or result from create if specified).

Implementation

Future<T?> get([Future<T?> Function() create, Duration ttl]);