Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > shelve(writeback=true) danger...

Reply
Thread Tools

shelve(writeback=true) danger...

 
 
Matthew Wilson
Guest
Posts: n/a
 
      10-15-2003
I'm going to use shelve to work with some large dicts, and I'm going to
use writeback=True to make sure all the edits get written back to the
file when I close it. Is there a way to force a writeback without
closing? It would be nice if I could occasionally flush the caches in
memory and write everything back to files without having to close and
reopen my shelf.
 
Reply With Quote
 
 
 
 
Skip Montanaro
Guest
Posts: n/a
 
      10-15-2003

Matthew> I'm going to use shelve to work with some large dicts, and I'm
Matthew> going to use writeback=True to make sure all the edits get
Matthew> written back to the file when I close it. Is there a way to
Matthew> force a writeback without closing? It would be nice if I could
Matthew> occasionally flush the caches in memory and write everything
Matthew> back to files without having to close and reopen my shelf.

Sure, you can call db.sync() explicitly. Try

import shelve
help(shelve)

from the interpreter prompt and note the last three paragraphs of the
DESCRIPTION section.

Skip

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments