shelve(writeback=true) danger...

Discussion in 'Python' started by Matthew Wilson, Oct 15, 2003.

  1. 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.
     
    Matthew Wilson, Oct 15, 2003
    #1
    1. Advertising

  2. 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
     
    Skip Montanaro, Oct 15, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ioannis Vranos
    Replies:
    14
    Views:
    837
    Claudio Jolowicz
    Apr 21, 2004
  2. Marco Bubke

    shelve and writeback

    Marco Bubke, Jan 7, 2004, in forum: Python
    Replies:
    1
    Views:
    443
    Marco Bubke
    Jan 7, 2004
  3. warren ali
    Replies:
    0
    Views:
    484
    warren ali
    Jan 20, 2005
  4. Lloyd Sheen

    Danger Danger Will Robinson Vista SP1

    Lloyd Sheen, Mar 19, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    452
    Lloyd Sheen
    Mar 19, 2008
  5. bdb112
    Replies:
    45
    Views:
    1,423
    jazbees
    Apr 29, 2009
Loading...

Share This Page