Persistence Adapters
Choose or write your own persistence adapter for full control on how the data will be saved
By default, if not explicitly stated, the database will use no persistence layer, all the data will live solely in memory and will be lost once you exit the application or database instance is lost or deleted. This behavior might be what you want. Yet, most of the use cases for the database involve some form of data persistence.
TyDB doesn't rely on one form of database persistence, rather it introduces the concept of pluggable persistence adapter. Since the database might be used in different environment and for different use cases, different adapter have been written. And you would "plug" the adapter that best suits your need. So, when running in the browser, you may want to use the IndexedDB adapter, and when running in NodeJS you may want to use the File system adapter.

File System persistence adapter
Read more about the file system persistence
IndexedDB persistence adapter
Read more about the browser and IndexedDB persistence
Write your own persistence adapter
Writing and plugging your own persistence adapter is fairly easy, start by extending the persistence class and overwrite some methods like the example below
For more elaborate example checkout the adapter that are shipped with the database on github.
Last updated
Was this helpful?