The python documentation says this about the sync method:
Write back all entries in the cache if the shelf was opened with writeback set to True. Also empty the cache and synchronize the persistent dictionary on disk, if feasible. This is called automatically when the shelf is closed with close().
I am really having a hard time understanding this. How does accessing data from cache differ from accessing data from disk? And does emptying the cache affect how we can access the data stored in a shelve?