mcache 1.0.1 copy "mcache: ^1.0.1" to clipboard
mcache: ^1.0.1 copied to clipboard

discontinued
outdated

Tools for caching values in memory. Supports setting the expiration of values.

example/README.md

Languages:

English Russian

Save values to cache:

void main(List<String> args) {
  var cache = Cache(deleteOnExpire: false);

  cache.set('name', 'Alex');

  cache.set('key', '1o23fjadijs');
}

Save and retrieve values from cache:

void main(List<String> args) {
  var cache = Cache(deleteOnExpire: false);

  cache.set('name', 'Alex');

  cache.set('key', '1o23fjadijs');

  print(cache['name']);

  print(cache['key']);
}

Save values and specify a lifetime for them:

void main(List<String> args) {
  var cache = Cache(checkPeriod: const Duration(seconds: 1));

  cache.set('name', 'Alex',
      expirationSetting:
          ExpirationSetting(expiration: const Duration(seconds: 3)));

  cache.set('key', '1o23fjadijs',
      expirationSetting:
          ExpirationSetting(expiration: const Duration(seconds: 3)));

  print(cache['name']);

  print(cache['key']);

  Future.delayed(const Duration(seconds: 4), () {
    print(cache['name']);

    print(cache['key']);

    cache.dispose();
  });
}

Записать значения и удалить их все:

void main(List<String> args) {
  var cache = Cache(deleteOnExpire: false);

  cache.set('name', 'Alex');

  print(cache['name']);

  cache.clear();

  print(cache['name']);
}
0
likes
150
pub points
47%
popularity

Publisher

verified publisherbatykov-gleb.ru

Tools for caching values in memory. Supports setting the expiration of values.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on mcache