It is connected to the context in the sense that query results that are localCached in one context will not be retrieved from the cache by another context (but instead hit the DB). However, the objects themselves may continue to reside in memory indefinitely until memory pressure causes them to be removed or the cache expires due to a timeout.
On Thu, Nov 9, 2017 at 10:40 AM Lon Varscsak <[email protected]> wrote: > In the case of using a more specific cache (like discussed in the other > thread), the problem is these “small” caches get abandoned. The > documentation says “localCache” is bound to the ObjectContext, but that > doesn’t appear to be true. > > -Lon > > On Wed, Nov 8, 2017 at 11:22 PM, Andrus Adamchik <[email protected]> > wrote: > > > NestedQueryCache is created per ObjectContext. The underlying data is > > stored in the common cache, prefixed with unique key. While that data is > > not actively removed from the cache when the ObjectContext (and its > > NestedQueryCache) go out of scope, it should not affect the overall cache > > performance. Since most caches have an LRU policy, those abandoned > entries > > will eventually be pushed out of the cache, replaced by more recent > entries > > from other contexts. > > > > Andrus > > > > > On Nov 9, 2017, at 2:08 AM, Lon Varscsak <[email protected]> > wrote: > > > > > > Hey all, > > > > > > I would have bet large sums of money that a custom implementation of > > > QueryCache would result in a new QueryCache object per context (local). > > > However, it looks like a NestedQueryContext gets created and only one > > > instance of the specified QueryCache is created (in > DataContextFactory). > > > > > > I'd really love to have local caches dumped when the ObjectContext goes > > > away (assuming it's a localCache). Is this possible? Thoughts? > > > > > > Thanks! > > > > > > -Lon > > > > >
