Skip to content

Storage Documentation

virtualWinter edited this page Aug 31, 2025 · 1 revision

Storage Library Documentation

This document provides an overview and usage examples for the various storage modules available in this library.

MongoDB

The storage-mongo module provides a simple way to interact with a MongoDB database.

Usage

// Initialize the MongoDB connection
Mongo mongo = new Mongo("mongodb://localhost:27017", "mydatabase");
mongo.init();
mongo.start();

// Get a collection
MongoCollection<MyObject> collection = mongo.getCollection(MyObject.class);

// ... perform operations on the collection

// Close the connection
mongo.end();

Redis

The storage-redis module provides a simple way to interact with a Redis server.

Usage

// Initialize the Redis connection
Redis redis = new Redis("localhost", 6379);
redis.init();

// Get the Jedis instance
Jedis jedis = redis.getJedis();

// ... perform operations with Jedis

// Close the connection
redis.end();

PostgreSQL

The storage-postgres module provides a simple way to interact with a PostgreSQL database.

Usage

// Initialize the PostgreSQL connection
Postgres postgres = new Postgres("localhost", 5432, "mydatabase", "user", "password", true);
postgres.init();

// Get a connection
Connection connection = postgres.getConnection();

// ... perform operations with the connection

// Close the connection
postgres.end();

MySQL

The storage-mysql module provides a simple way to interact with a MySQL database.

Usage

// Initialize the MySQL connection
MySQL mysql = new MySQL("localhost", 3306, "mydatabase", "user", "password", true);
mysql.init();

// Get a connection
Connection connection = mysql.getConnection();

// ... perform operations with the connection

// Close the connection
mysql.end();

MariaDB

The storage-mariadb module provides a simple way to interact with a MariaDB database.

Usage

// Initialize the MariaDB connection
MariaDB mariadb = new MariaDB("localhost", 3306, "mydatabase", "user", "password", true);
mariadb.init();

// Get a connection
Connection connection = mariadb.getConnection();

// ... perform operations with the connection

// Close the connection
mariadb.end();

SQLite

The storage-sqlite module provides a simple way to interact with a SQLite database.

Usage

// Initialize the SQLite connection
SQLite sqlite = new SQLite("mydatabase.db");
sqlite.init();

// Get a connection
Connection connection = sqlite.getConnection();

// ... perform operations with the connection

// Close the connection
sqlite.end();

YAML

The storage-yml module provides a simple way to interact with YAML files.

Usage

// Initialize the YAML handler
Yml yml = new Yml("config.yml");
yml.load();

// Get the data
Map<String, Object> data = yml.getData();

// ... perform operations with the data

// Save the data
yml.save();

JSON

The storage-json module provides a simple way to interact with JSON files.

Usage

// Initialize the JSON handler
Json<MyObject> json = new Json<>("data.json", MyObject.class);
json.load();

// Get the data
MyObject data = json.getData();

// ... perform operations with the data

// Save the data
json.save();

Clone this wiki locally