[ZODB-Dev] Re: two level cache
dieter at handshake.de
Fri Mar 30 17:13:02 EDT 2007
Atmasamarpan Novy wrote at 2007-3-30 01:06 +0200:
>I was looking at code in the meanwhile and I was thinking more in the
>direction of caching of pickles instead of sharing objects among
>connections. It means that moving from L2 into L1 would require to
>unpickle the object and it is certainly not for free. But it still seems
>to me much better than to load it from disk.
>Inside ZODB.Connection, the call:
>p, serial = self._storage.load(oid, self._version)
>would be replaced by
>p, serial = self._db.loadFromCache(oid, self._version)
>if p is None:
> p, serial = self._storage.load(oid, self._version)
> self._db.saveToCache(oid, self._version, p, serial)
>Cache access has to be made thread safe, but we do not want to block it
>Next thing is that we have to make sure an object is thrown from cache
>when it is invalidated.
Something like this would be feasible as the ZEO "ClientCache"
precisely works this way (apart from the fact that it puts
the data onto disk rather than keep it in RAM).
However, performed locally, it mostly duplicates what
the OS' disk cache would do. Thus, maybe not worth the effort
and additional complexity.
More information about the ZODB-Dev