Skip to content

Commit

Permalink
ADD beta hint
Browse files Browse the repository at this point in the history
  • Loading branch information
pubkey committed Apr 27, 2024
1 parent 8e5759c commit 8c430df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
11 changes: 5 additions & 6 deletions docs-src/docs/rx-storage-memory-mapped.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ slug: rx-storage-memory-mapped.html
---


# Memory Mapped RxStorage
# Memory Mapped RxStorage (beta)

The memory mapped [RxStorage](./rx-storage.md) is a wrapper around any other RxStorage. The wrapper creates an in-memory storage that is used for query and write operations. This memory instance is kept persistent with a given underlying storage.

Expand All @@ -21,9 +21,10 @@ The memory mapped [RxStorage](./rx-storage.md) is a wrapper around any other RxS
- When the JavaScript process is killed ungracefully like when the browser crashes or the power of the PC is terminated, it might happen that some memory writes are not persisted to the parent storage. This can be prevented with the `awaitWritePersistence` flag.
- The memory-mapped storage can only be used if all data fits into the memory of the JavaScript process. This is normally not a problem because a browser has much memory these days and plain json document data is not that big.
- Because it has to await an initial data loading from the parent storage into the memory, initial page load time can increase when much data is already stored. This is likely not a problem when you store less then `10k` documents.
- The `memory-mapped` storage is part of [RxDB Premium 👑](/premium). It is not part of the default RxDB core module.

:::note Premium
The `memory-synced` plugin is part of [RxDB Premium 👑](/premium). It is not part of the default RxDB core module.
:::warning beta
The Memory-Mapped RxStorage is in **beta** mode and it might get breaking changes without a major RxDB release.
:::

## Using the Memory-Mapped RxStorage
Expand All @@ -43,7 +44,7 @@ import {
*/
const parentStorage = getRxStorageIndexedDB();

// wrap the persistent storage with the memory synced one.
// wrap the persistent storage with the memory-mapped storage.
const storage = getMemoryMappedRxStorage({
storage: parentStorage
});
Expand Down Expand Up @@ -78,14 +79,12 @@ import {
} from 'rxdb-premium/plugins/storage-memory-mapped';
import { wrappedKeyEncryptionWebCryptoStorage } from 'rxdb-premium/plugins/encryption-web-crypto';

// wrap the persistent storage with the encryption wrapper synced one.
const storage = getMemoryMappedRxStorage({
storage: wrappedKeyEncryptionWebCryptoStorage({
storage: getRxStorageIndexedDB()
})
});

// create the RxDatabase like you would do with any other RxStorage
const db = await createRxDatabase({
name: 'myDatabase,
storage,
Expand Down
9 changes: 7 additions & 2 deletions docs-src/docs/rx-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,15 @@ The Remote RxStorage is made to use a remote storage and communicate with it ove

On some `RxStorage` implementations (like IndexedDB), a huge performance improvement can be done by sharding the documents into multiple database instances. With the sharding plugin you can wrap any other `RxStorage` into a sharded storage. [Read more](./rx-storage-sharding.md)

### 👑 Memory Mapped

The memory-mapped [RxStorage](./rx-storage.md) is a wrapper around any other RxStorage. The wrapper creates an in-memory storage that is used for query and write operations. This memory instance stores its data in an underlying storage for persistence.
The main reason to use this is to improve query/write performance while still having the data stored on disc. [Read more](./rx-storage-memory-mapped.md)

### 👑 Memory Synced

The memory synced [RxStorage](./rx-storage.md) is a wrapper around any other RxStorage. The wrapper creates an in-memory storage that is used for query and write operations. This memory instance is replicated with the underlying storage for persistence.
The main reason to use this is to improve initial page load and query/write times. This is mostly useful in browser based applications. [Read more](./rx-storage-memory-synced.md)
The memory-synced [RxStorage](./rx-storage.md) is a wrapper around any other RxStorage. The wrapper creates an in-memory storage that is used for query and write operations. This memory instance is replicated with the underlying storage for persistence.
The main reason to use this is to improve initial page load and query/write times. This is mostly useful in browser based applications. While the memory-synced storage has its use cases, by default you should use the [Memory-Mapped RxStorage](./rx-storage-memory-mapped.md) instead. [Read more](./rx-storage-memory-synced.md)

### 👑 Localstorage Meta Optimizer

Expand Down

0 comments on commit 8c430df

Please sign in to comment.