Re: How cache invalidations work (and hack to listen in) (was Re: Applause for ZODB! And a question: How do you get pending change info from a transaction object?)

David Pesta <[email protected]> Fri, 04 May 2018 17:52:11 +0000
Newsgroups gmane.comp.web.zope.zodb
Message-ID <CAKFM0AGrYLVjGhQfrs=LK9W4sRBbpW0GgEprMQovj-BhKcG=Gg@mail.gmail.com>
Your solution/hack is elegant. As I make progress toward implementing it
(still getting the kinks out in my free time, but coming along), I had a
couple questions.

- In cases where I'm wanting a socket to keep track of a completely new
object and establish that relationship before the transaction is committed,
from my testing so far it doesn't look like the object has an oid yet. Do I
need to set up a mechanism that keeps track of this and swings around and
updates my association with the oid later? If so, is that when a
transaction hook is warranted? Or are you wanting everyone to avoid
transaction hooks for everything? Or did I make a mistake and this isn't a
problem after all? (I'm still tinkering toward all this.)

- In my testing, I noticed that the connection cannot get details for an
existing object using an oid until that object was at least accessed from
some path using root first. I'm guessing that the connection "get" with oid
looks for it in the cache and does not go all the way to the database. A
listening socket will only be given the oid when the object gets an update,
but all of this is ok so far because a listening socket will have needed
the actual object at some point in order to initiate the listening, thus
the object will be in the cache and just the oid will work. Or will it?
Doesn't cache invalidation mean the object (or its updated details) is no
longer in the cache? Once that happens and the socket is informed with the
oid, it no longer can use the oid to get the details? Or is that not the
case? Another idea for me that might work is if I store not just the oid
but also a reference to the object. When the oid comes in, I use the object
reference that I keep along with the oid instead of using the oid to fetch
the object with the connection "get". That way it fetches the updated
details all the way from the database using the object reference. Is that
what needs to be done?

Again, these are things I think I'm seeing in my testing in anticipation of
developments I am approaching. If anything above is convoluted nonsense,
feel free to let me know! :)

Many thanks!

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.