Through trial and error, I figured out that I was using it wrong. With
the JCache API, you have to make sure that you "create" and register
the cache once on each GAE instance (JVM) before you can just do a
getCache(String cachename) on it within that JVM.

So even in code that only reads from the cache, you need to make sure
the full cache initialization is performed or has already been done
somewhere in that JVM instance. For example:

cache = CacheManager.getInstance().getCache("testcache");
if (cache == null) {
      cache = CacheManager.getInstance().getCacheFactory()
            .createCache(Collections.emptyMap()); //Or whatever
properties are required
      CacheManager.getInstance().registerCache("testcache", cache);
}

This is the same code you use to create and register the global cache
in the first place. For new instances, it appears to just create the
required link to the existing global cache. Makes sense to me now
since you don't know which instance or reader/writer code will be hit
the first time a cache comes into play.

After invoking the code above in my readers, I now see the cache and
entries in it being shared globally.

Thanks,
Tom

On Dec 15, 10:42 pm, Tom Phillips <[email protected]> wrote:
> I posted on this this in the java forum, but no traction there and I
> suspect it's not java specific.
>
> Memcache entries seem to be being scoped to an instance, not global.
> After a cache entry is made, it can be retrieved fine for any request
> that goes to that same instance. Any request to one of the other
> instances never finds the entry in the cache.
>
> Bug in Always On? Bug in 1.4.0? Design intent?
>
> Thanks,
> Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to