hope_cache 0.1.5 copy "hope_cache: ^0.1.5" to clipboard
hope_cache: ^0.1.5 copied to clipboard

Simple and fast caching for Dart/Flutter with TTL support, multiple eviction strategies, and pluggable storage.

example/main.dart

// ignore_for_file: avoid_print
import 'package:hope_cache/cache_manager.dart';

/// Hope Cache Examples
///
/// See other examples in this directory:
/// - basic_usage.dart       → basic set/get/invalidate
/// - ttl_configuration.dart → per-key TTL overrides
/// - eviction_policies.dart → LRU, LFU, FIFO
/// - custom_storage.dart    → pluggable storage backends
/// - map_key.dart           → React Query-style map keys
/// - query.dart             → advanced querying
void main() async {
  final cache = await CacheManager.create(
    maxSize: 1024 * 1024,
    defaultTTL: Duration(minutes: 5),
    evictionPolicy: EvictionPolicy.lru,
  );

  await cache.set('hello', 'world');
  final value = await cache.getIfPresent('hello');
  print('hope_cache works! → $value');
}
1
likes
160
points
67
downloads

Documentation

API reference

Publisher

verified publishersupgrow.com

Weekly Downloads

Simple and fast caching for Dart/Flutter with TTL support, multiple eviction strategies, and pluggable storage.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on hope_cache