LibSQL Class
sync()
LibSQL PHP Extension method sync()
The sync()
method in the LibSQL PHP Extension is used to sync changes from the remote database to the local replica, embedded replicas provide a smooth switch between local and remote database operations, allowing the same database to adapt to various scenarios effortlessly. They also ensure speedy data access by syncing local copies with the remote database, enabling microsecond-level read operations โ a significant advantage for scenarios demanding quick data retrieval.
Method Signature
public function sync(): void
Parameters
This method does not accept any parameters.
Return Value
This method does not return any value (void
).
Example
// Create a new LibSQL instance
$db = new LibSQL("database.db");
// Perform database operations...
// Sync the database
$db->sync();
Notes
- Do not open the local database while the embedded replica is syncing. This can lead to data corruption.
- In certain contexts, such as serverless environments without a filesystem, you canโt use embedded replicas.
Was this page helpful?