So previously this year, I posted about about how while fetching an object that it’s relationships weren’t automatically refreshing, even though I was not caching (myself) any data. This is where I learned about “shared caches” and realized that if I turned it off, I kind of get the behavior I want (except now peer synchronization doesn’t work). Data within a single context is cached (if I choose), but once the context is gone, the snapshots are gone. It doesn’t seem to make sense that a global cache would hold onto snapshots beyond the life of the objects across contexts…but that’s what it appears to do.
The response was, “refresh your relationships with prefetches”. This doesn’t seem like a clean solution to me. It forces the developer to “be aware” of stale data and force fetches on relationships that they might not need in that moment. Realize that a lot of components in my application might shared data (like a Customer, or an Order), but the components don’t necessarily access all of the information in those relationships. I believe EOF, the snapshot would decrement to 0 (when that snapshot wasn’t referred to anymore by any context) and the next fetch would be fresh. Is there no concept like this for Cayenne? Any help would be appreciated. It’s very possible I’m just missing the obvious approach. -Lon