Force all buffered modifications to be written to disk. Parameters ---------- fsync : bool (default False) call ``os.fsync()`` on the file handle to force writing to disk. Notes ----- Without ``fsync=True``, flushing may not guaran
(self, fsync: bool = False)
| 780 | return bool(self._handle.isopen) |
| 781 | |
| 782 | def flush(self, fsync: bool = False) -> None: |
| 783 | """ |
| 784 | Force all buffered modifications to be written to disk. |
| 785 | |
| 786 | Parameters |
| 787 | ---------- |
| 788 | fsync : bool (default False) |
| 789 | call ``os.fsync()`` on the file handle to force writing to disk. |
| 790 | |
| 791 | Notes |
| 792 | ----- |
| 793 | Without ``fsync=True``, flushing may not guarantee that the OS writes |
| 794 | to disk. With fsync, the operation will block until the OS claims the |
| 795 | file has been written; however, other caching layers may still |
| 796 | interfere. |
| 797 | """ |
| 798 | if self._handle is not None: |
| 799 | self._handle.flush() |
| 800 | if fsync: |
| 801 | with suppress(OSError): |
| 802 | os.fsync(self._handle.fileno()) |
| 803 | |
| 804 | def get(self, key: str): |
| 805 | """ |