You can download the code for this example here: OnyxDevTools/onyx-database-samples/cache-manager.
A Cache Manager Factory is used to configure your In-Memory Database.
Onyx Cache compresses and indexes your data.
It allows you to take advantage of accessing and storing entities using off-heap resources while also
taking advantage of all the Onyx Database ORM features.
Note: It is best practice to use the factory to create a global singleton instance rather than constructing a new manager each time you use it.
This step is optional. If you do not specify a username or password. The credentials will default to admin/admin.
By initializing the cache manager factory, you will retain a lock so that it cannot be opened by another process.
Now that you have an instance of the PersistenceManager you can use it to save, update, query and delete entities from memory.
By default Onyx Database adds a JVM shutdown hook upon the termination of the process. It is always a good idea to manually call close when you are finished with the database connection in order to prevent potential data loss.