Persistence requires an additional Provider module.
Official Enmap Providers:
Enmap-SQLite: Recommended, supports sharding locally.
Enmap-Rethink: Best for sharding if you can install a rethinkdb server. Supports updating from the database on all shards (enmap-rethink 2.1.0 and higher)
Enmap-PGSQL: Postgresql database provider. Supports Sharding.
Enmap-Mongo: Mongodb database provider. Supports Sharding.
Enmap-Level: Sort of not recommended at this point, doesn't support sharding, no longer the most efficient/faster provider.
When using any provider, it's very important to understand that it takes time to load the data from the database. Certain providers also take some time to even open the database connection, and that's also something to consider.
To make sure that all your data is loaded before you start working, Enmap provides a handy property called defer
, which is a promise that is resolved once the provider is ready and all the data has been loaded into memory. There are a few ways to use defer
, since it's a promise.