```{index} single: sync (DB_File) ``` ```{index} single: DB_File::sync ``` # sync Write everything stored so far to the file and to disk, so that other processes - and the file after a crash - have it. ## Synopsis ```perl $db->sync; ``` ## What you get back 0, or -1 for an error. The only flag it takes is `R_RECNOSYNC`, which is 0; any other returns -1. ## Edge cases - A `$DB_RECNO` array writes its text file only when an element changed since the last write. - Without `sync`, writes reach the file at `untie`, or as they happen with `$Peta::LMDB::DBM_WRITE = 'through'`. ## Differences from upstream Fully compatible with upstream. Covered by `t/82-native/Peta-LMDB/100-db_file.t`. ## See also - `fd` - the file's descriptor