Hi

In addition google recycles instances around every 10,000 requests.

Rgds

T

On Nov 23, 7:11 pm, Simon <[email protected]> wrote:
> You are going to get a JCache instance for every GAE JVM-instance
> which is spun up and there's no guarantee (in fact in my experience
> it's pretty unlikely) that your GAE-instance will even be up for 2
> hours.  It's worth remembering that you can have multiple GAE-
> instances running at the same time and take that into consideration
> for your app's design - you have no idea what instance your cron job
> will run on, but it will only ever work against one of your instances.
>
> On Nov 22, 12:40 am, Joerg Weingarten <[email protected]> wrote:
>
>
>
>
>
>
>
> > I am using Memcache/JCache to add certain Strings to the Cache.
> > Somehow I thought there would be only 1 instance of my cache that is
> > shared across my application. To refresh my cache I have a cron job
> > that is supposed to do the refresh, if needed. What I am seeing though
> > is that the cache gets always refreshed. What am I missing?
>
> > Sample code:
>
> >                 Cache cache = null;
> >                 try {
> >                 cache = CacheManager.getInstance().getCache("TIPCache");
> >                 if (cache == null) {
> >                                 CacheFactory cacheFactory =
> > CacheManager.getInstance().getCacheFactory();
> >                                 cache = 
> > cacheFactory.createCache(Collections.emptyMap());
> >                                 
> > CacheManager.getInstance().registerCache("TIPCache", cache);
> >                         }
> >                         if (!cache.containsKey("somekey")) {
> >                            cache.put("somekey", "some string");
> >                            log.info("Cache updated");
> >                         }
> >                         else {
> >                            log.info("Cache up to date");
> >                         }
> >                 } catch (CacheException e) {
> >                         log.severe("Could not create CACHE instances!");
> >                 }
>
> > Code like the above is running every 2 hours using a cron job. I would
> > expect to see the message "Cache up to date", but I see "Cache
> > updated" every 2 hours.
>
> > What am I doing wrong?
> > Thx
> > ---Joerg---

-- 
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