Skip to content

DataManager

Sammy Aknan edited this page Mar 14, 2025 · 3 revisions

The DataManager has a number of responsibilities and only one instance should exist per application. Simply put, it manages all cached data.

Creating a DataManager

Here's an example on creating a DataManager:

DataSourceConfig dataSourceConfig = new DataSourceConfig(
                System.getenv("DATABASE_HOST"),
                Integer.parseInt(System.getenv("DATABASE_PORT")),
                System.getenv("DATABASE_DATABASE"),
                System.getenv("DATABASE_USERNAME"),
                System.getenv("DATABASE_PASSWORD"),
                System.getenv("REDIS_HOST"),
                Integer.parseInt(System.getenv("REDIS_PORT"))
        );

DataManager dataManager = new DataManager(dataSourceConfig);

Note that the DataManager instance will need to be passed around frequently.

Clone this wiki locally