The old docs describe the Object cache(s) like so: A cache shared between ObjectContexts has a fixed upper limit. 10000 is the default maximum number of entries, which can be changed in the Modeler. A cache attached to each ObjectContext (also referred to as "local cache" elsewhere in this chapter), which only stores the objects that were accessed via this context, has no upper limit.
https://cayenne.apache.org/docs/3.0/individual-object-caching.html So there is a Shared cache and a Local cache. The default behavior for relationship faulting (lazy loading) is to place these objects into the *Shared* cache. Same with Cayenne.objectForPK. This can cause the shared cache to get large, and in some cases I've had objects that I really wanted to be cached forever to get pushed out of the Shared cache by poorly written code that fires a ton of lazy relationships. Also this can cause stale data to be returned when not carefully guarding against it with prefetches that refresh any needed relationships. I'd prefer that objects from lazily loaded relationships be placed in the *Local* cache to eliminate both of these problems. I really only want to ever use the Shared cache *explicitly*, never implicitly. So this default behavior seems backwards to me. Is there a way to change this? It seems like a DI property could switch between these two modes. Thanks, John
