cache_store

A Dart store for caching instances to various backends (memory, file, ...).

Quickstart

Future<Cache<int>> update(String key) async {
  await Future.delayed(const Duration(seconds: 2));
  return Cache.fromNow(
    key: key,
    value: 42,
    expiresIn: const Duration(seconds: 1),
  );
}

final store = MemoryCacheStore<int>();

var entry = await store.get("test", ifExpired: update);

Libraries

cache_store