js-data

Respect Your Data

Give your data the treatment it deserves with a framework-agnostic, datastore-agnostic JavaScript ORM built for ease of use and peace of mind. Works in Node.js and in the Browser.

Get Started

Identity Map

Concepts

Identity Map

The Identity Map Pattern is a technique JSData uses to prevent duplicate in-memory representations of database records. JSData assumes that any saved record has some sort of unique identifier—a primary key. With this key JSData can construct an in-memory Identity Map—a cache. This Identity Map is implemented using the DataStore component. DataStore extends Container (mentioned above) so it manages your Mapper instances while also providing an in-memory record cache.

👍

Tip

The use case for the DataStore component makes the most sense in the browser. In general, server-side apps should just use the Container component.

Read more about the Container and DataStore components.

Once a record is added to an instance of DataStore, any reference to that record will remain valid until that record is removed from the store. Any record added to the store that has the same primary key as a record already in the store will be merged with the existing record, which is why a reference to the originally added record will stay valid.

👍

Tip

Read more about Working with the DataStore.

Updated less than a minute ago


Identity Map


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.