Dual

Using two drivers

This library is abandoned. Please consider using a different library.

Dual driver is pretty handy when you want to migrate from one data store driver to another, or when you need a fallback. It features an auto-sync feature to copy the data from fallback (secondary) driver to primary driver.

The below example illustrates how to smoothly migrate from PHPFile driver to JSONFile driver, without manually converting the data.

use Opis\DataStore\Drivers{
    Dual,
    PHPFile,
    JSONFile
};

$primary = new JSONFile("/path/to/json/dir");
$secondary = new PHPFile("/path/to/php/dir");

$dataStore = new Dual($primary, $secondary, true);

// Use data store here ...