Query results cache question


Page bloom
 
Edited

I have a JDO query that is caching its result set which makes sense as caching results sets is turned on by default.

Part of the app adds a new object to the database (and I verify that the new record has been created in the datastore) and so when a new query is run the new object is not picked up, as expected, because the query results (cached from before the time that new object was created) do not include that new object.

All makes sense up to here.

If I log in as a new user in a different browser I see a query result which *includes* the new object - that makes me think that it's caching per user session - which it can't be because DN has no concept of user session.

If I look at the example given for how to evict a query's result set from the cache:

import org.datanucleus.api.jdo.JDOQueryCache;
import org.datanucleus.api.jdo.JDOPersistenceanagerFactory;

...
JDOQueryCache cache = ((JDOPersistenceManagerFactory)pmf).getQueryCache();

cache.evict(query);

we see that it is operating at the PMF level. The app should only have one PMF regardless of how many sessions are created so I am at a loss as to know why the new user sees the uncached version of the result set (i.e. sees the new object) yet the previous user still sees the cached result set without the new object.

I'm continuing to research this (including if due to some action/bug by our app) but if anyone has any suggestions for how this might be occurring it would be most appreciated.