Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 672 Bytes

lazy_box.md

File metadata and controls

18 lines (11 loc) · 672 Bytes

Lazy box

By default, the entire content of a box is stored in memory as soon as it is opened. This behavior is great for small and medium-sized boxes because you can access their contents without async calls.

For larger boxes or very memory critical applications, it may be useful to load values lazily. When a lazy box is opened, all of its keys are read and stored in memory. Once you access a value, Hive knows its exact position on the disk and gets the value.

var lazyBox = await Hive.openLazyBox('myLazyBox');

var value = await lazyBox.get('lazyVal');

To get an already opened lazy box call:

var lazyBox = Hive.lazyBox('myLazyBox');