MicroStream Reference Manual
MicroStream HomeAPI Docs
2.0
2.0
  • Preface
  • System Requirements
  • License
  • Installation
  • Data-Store
    • Overview
    • Getting Started
    • Root Instances
    • Configuration
      • Properties
      • Storage Files and Directories
      • Using Channels
      • Housekeeping
      • Backup
      • Lock File
    • Storing Data
      • Convenience Methods and Explicit Storing (Transactions)
      • Lazy and Eager Storing
      • Transient Fields
      • Best Practice
    • Loading Data
      • Lazy Loading
        • Touched Timestamp, Null-Safe Variant
        • Clearing Lazy References
    • Deleting Data
    • Queries
    • Application Life-Cycle
    • Legacy Type Mapping
      • User Interaction
    • Backup Strategies
    • Import / Export
    • Housekeeping
    • FAQ
      • Data Model
      • Data Management
      • File Storage
      • Miscellaneous
    • Customizing
      • Custom Type Handler
      • Custom Legacy Type Handler
      • PersistenceEagerStoringFieldEvaluator
Powered by GitBook
On this page
  • Lazy Storing
  • Eager Storing
  • Usage
  • Custom Handling
Export as PDF
  1. Data-Store
  2. Storing Data

Lazy and Eager Storing

PreviousConvenience Methods and Explicit Storing (Transactions)NextTransient Fields

Last updated 3 years ago

This is the manual for older MicroStream versions (Version < 5.0).

The new documentation (Version >= 5.0) is located at:

The MicroStream engine supports two general storing strategies: Lazy and eager storing. By default, MicroStream uses the lazy storing strategy.

These storing strategies differ in the way how objects, referenced by the object to be stored are handled if those referenced objects had already been stored.

Lazy Storing

Lazy storing is the default storing mode of the MicroStream engine.

Referenced instances are stored only if they have not been stored yet. If a referenced instance has been stored previously it is not stored again even if it has been modified.

That's why modified objects must be stored explicitly

Eager Storing

In eager storing mode referenced instances are stored even if they had been stored before. Contrary to Lazy storing this will also store modified child objects at the cost of performance.

Usage

To use lazy or eager storing explicitly, get an instance of the required Storer and use it's store methods:

Storer storer = storage.createEagerStorer();
storer.store(myData);
storer.commit();

Available Storers are:

storage.createLazyStorer()

storage.createEagerStorer()

Standard storing:

storage.createStorer()

will provide corresponding Storer instances.

Custom Handling

Beside the 'global' lazy or eager storing strategies MicroStream allows to implement an individual handling for the storing behavior. See for details.

https://docs.microstream.one/
PersistenceEagerStoringFieldEvaluator