Skip to content

Documentation

BooleanCube edited this page Apr 5, 2023 · 12 revisions

Visit the official documentation for more.

Documentation for Builds

Build Version Documentation Link
v1.0.7 Documentation (Build v1.0.7)
v1.1.3 Documentation (Build v1.1.3)
v2.1.0 Documentation (Build v2.1.0)

Basic Database Implementation and Usage

DatabaseManager is the main database manager class which will give you access to every database.
DatabaseObject is the database object class with all the methods to access the data within the database.

/**
 * Creates a database file and adds it to the cache
 * @param dbName database name
 * @return boolean indicating success or failure
 * @throws LimitExceededException 10 databases at max
 * @throws FileAlreadyExistsException no duplicate databases can be created
 * @throws FileNotFoundException could not find directory
 */
DatabaseManager.createDatabase("database_name");

/**
 * Returns the database object based on the database name
 * @param dbName database name
 * @return {@link DatabaseObject} representing a database
 */
DatabaseObject database = DatabaseManager.getDatabase("database_name");

/**
 * Get database name
 * @return String with database name
 */
database.getName();

/**
 * Get value given key from the cache
 * @param key String key
 * @return Object value corresponding to key
 */
database.getValue("key");

/**
 * Get value given key as integer from the cache
 * @param key String key
 * @return Integer value corresponding to key
 */
database.getIntegerValue("key");

/**
 * Get value given key as a long from the cache
 * @param key String key
 * @return Long value corresponding to key
 */
database.getLongValue("key");

/**
 * Update value at key, Add if key does not exist
 * (both database and cache)
 * @param key key String to new value
 * @param value new value Object
 */
database.updateValue("key", "value");

/**
 * Add key to value relationship
 * (both database and cache)
 * @param key key String of value
 * @param value value Object corresponding to key
 */
database.addKey("key", "value");

/**
 * Remove key
 * both database and cache
 * @param key key String to be removed
 */
database.removeKey("key");
Clone this wiki locally