On Fri, 11 Aug 2006, Bob Hutchison wrote:

How fast is fast enough, and what kind of transaction support do you need?

I have a class that is part of the suite of caches I provide in IOWA that 
I have recently been working on.

It's called a DiskCache because it implements an LRU cache that operates 
exclusively through persistent storage, but the expiration of elements can 
be turned off, turning it into a simple persistent storage mechanism. 
Because it operates exclusively through persistent storage, it requires no 
in-memory indexes or other data structures.  This was important to me 
because if one were using PStore with many small transactions on any 
data set that was not tiny (less than a thousandish elements), PStore's 
index reading/writing overhead became troublesome, and I didn't want to 
incur the RAM hit of an in memory index for a very large data set, 
either.

It's relatively fast (it is much faster than PStore for non-trivial data 
sets since PStore requires reading an index into memory for each 
transaction), platform independent (well, I have tested it on Linux and 
Win XP) and it is multiprocess/threadsafe.

It supports transactions as well as nested transactions.

i.e.

@cache.transaction do
   @cache[:a] = 1
   @cache.transaction do
     @cache[:b] = 2
     @cache.transaction do
       @cache[:c] = 3
       rollback
     end
     commit
   end
   rollback
end

At the end of those transactions, @cache[:b] == 2, and the two other items 
have been rolled back.

I'm currently expanding the test cases for it and cleaning up some bugs, 
and will go ahead and release it as a standalone package this weekend. 
Maybe it will help you.


Kirk Haines