App Engine javax.jdo.option.RetainValues and caching

148 views Asked by At

So my question to the App Engine team started out as why is it sometimes when I do a:

mgr.makePersistent(obj);
mgr.close()

I can come back 15 minutes later and query that same object only to find it has old values in it. They replied that this is by design and that cache on some instances may never be cleared by a put, which sounds odd to me since the whole idea of caching isn't to hold on to old values forever, but rather to replace those values with the new ones after an update right?

So they suggested I turn off javax.jdo.option.RetainValues by setting this to false in my jdoconfig.xml.

I am clearly missing something since I know this property is set to true in all of their examples and I have never seen this behavior before. Thanks for the insight!

UPDATE

My get code looks like this:

PersistenceManager mgr = getPersistenceManager();
    MyClass lMyClass = null;
    try {
        lMyClass = mgr.getObjectById(MyClass.class, id);
    } finally {
        mgr.close();
    }
    return object;

My update looks like this:

PersistenceManager mgr = getPersistenceManager();
    try {

        mgr.makePersistent(lMyClass);
    } finally {
        mgr.close();
    }
    return lMyClass;

When I do the update and then the get 15 minutes later the Java object returned by the get has old values in it. This is a standard app engine application, the PMF is a singleton. Any other details I can provide to be more helpful, thanks for the help!

0

There are 0 answers