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