1. Go to this page and download the library: Download stuttter/ludicrousdb library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
stuttter / ludicrousdb example snippets
$wpdb->add_database( array(
'host' => DB_HOST, // If port is other than 3306, use host:port.
'user' => DB_USER,
'password' => DB_PASSWORD,
'name' => DB_NAME,
) );
$wpdb->add_database( array(
'host' => DB_HOST, // If port is other than 3306, use host:port.
'user' => DB_USER,
'password' => DB_PASSWORD,
'name' => DB_NAME,
'write' => 0,
'read' => 1,
'dataset' => 'global',
'timeout' => 0.2,
) );
host ((optional) Whether server is readable. Default is 1 (readable).
Also used to assign preference. See "Network topology".
write (optional) Whether server is writable. Default is 1 (writable).
Also used to assign preference in multi-primary mode.
dataset (optional) Name of dataset. Default is 'global'.
timeout (optional) Seconds to wait for TCP responsiveness. Default is 0.2
lag_threshold (optional) The minimum lag on a replica in seconds before we consider it lagged.
Set null to disable. When not set, the value of $wpdb->default_lag_threshold is used.