<br><div class="gmail_quote">On Fri, Aug 19, 2011 at 8:31 AM, Forafo San <span dir="ltr"><<a href="mailto:ppv.grps@gmail.com">ppv.grps@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Folks,<br>
What might be a good replacement for the shelve module, but one that<br>
can handle a few gigs of data. I'm doing some calculations on daily<br>
stock prices and the result is a nested list like:<br>
<br>
[[date_1, floating result 1],<br>
[date_2, floating result 2],<br>
...<br>
[date_n, floating result n]]<br>
<br>
However, there are about 5,000 lists like that, one for each stock<br>
symbol. Using the shelve module I could easily save them to a file<br>
( myshelvefile['symbol_1') = symbol_1_list) and likewise retrieve the<br>
data. But shelve is deprecated AND when a lot of data is written<br>
shelve was acting weird (refusing to write, filesizes reported with an<br>
"ls" did not make sense, etc.).<br></blockquote><div><br>I'd probably use a cachedb, though perhaps I'm biased since I wrote it:<br><a href="http://stromberg.dnsalias.org/~dstromberg/cachedb.html">http://stromberg.dnsalias.org/~dstromberg/cachedb.html</a><br>
<br>It'll allow you to specify functions for serializing and deserializing values (but not keys), and cache a user-specified number of values in virtual memory. IOW, once you instantiate the class, you pretty much get caching and seralizing/deserializing as freebies, without the details of same getting scattered throughout your code.<br>
<br>It wraps something like gdbm.<br><br><br></div></div>