hive_universal_cache 0.2.1 copy "hive_universal_cache: ^0.2.1" to clipboard
hive_universal_cache: ^0.2.1 copied to clipboard

A general framework for caching dart object model in Hive. This package currently support JSON parsable objects and, Hive types.

A general framework for caching dart object model in Hive.

Features #

This package currently support JSON parsable objects and, Hive types.

It has a background Cache Invalidation support at the time of fetching the data.

It also implements TTL in over the Hive framework.

Getting started #

To start using the package go through Hive basics

To utilize this package register your data models before initializing the Cache Store. Also, don't forget to initialize Hive beforehand.

Usage #

  1. Initializing store JSON Parsable Object and, Hive Typed Object.
import 'package:hive_universal_cache/hive_universal_cache.dart';
final store = CacheStore(name: "test", policy: CachePolicy.main);
CacheTypeRegistry.instance.registerJsonAdapter<TestModel>(TestModel.fromJson);
CacheTypeRegistry.instance.registerHiveTypeAdapter<HiveTestModel>(HiveTestModelAdapter());
store.init();
  1. Set and, Get example
await store.set<TestModel>("test", TestModel(key: "test"));
final data = await store.get<TestModel>("test");

For more detailed examples, kindly go to Examples

Additional information #

This package is just on the initial phase, next inclusions will be :

  1. Wrapper over http to directly put cacheable content.
  2. Adding support for Images and, Files.
3
likes
140
pub points
52%
popularity

Publisher

verified publishervishal-kumar.com

A general framework for caching dart object model in Hive. This package currently support JSON parsable objects and, Hive types.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

crypto, hive, json_annotation

More

Packages that depend on hive_universal_cache