hive_cache 0.1.3 hive_cache: ^0.1.3 copied to clipboard
A persistent cache that uses hive.
import 'package:hive/hive.dart';
import 'package:hive_cache/hive_cache.dart';
void main() async {
await Hive.init('.');
final cache = HiveCache();
await cache.initialize();
await cache.setRootKeys(['fruits', 'nuts']);
await cache.put('apple', 'fruits', 2);
await cache.put('other', 'fruits', 3);
await cache.put('some', 'fruits', 'string');
print(await cache.getChildrenOfType<int>('fruits'));
print(await cache.getChildrenOfType<String>('fruits'));
}